[libxml++] [Fwd: DTD validation for libxml++]




--- Begin Message ---
Hello Christophe,


I have added some DTD validation to libxml++ which I would like to give back to the libxml++ community.

I have made sure to develop this extra code in the style and spirit of libxml++. As you'll see, it follows the features offered by libxml2 and as such is only a thin wrapper.

The code has been tested and is currently being used succesfully.


To get an easy to use DTD validation, I have created a DtdValidator class (derived from a generic Validator).

This object is in fact a parsed tree of an dtd file. The validator is created like a parser, from a stream or a file, or memory or a subset.
It encapsulates a Dtd object internally.

To valide an xml document, all the user has to do is :

try
{
   xmlpp::DtdValidator validator( dtdFileName );
   xmlpp::Document *pDoc = ...
   validator.validate( pDoc );
}
catch( const xmlpp::parse_error& )
{
   ...
}
catch( ... )
{
}

In my application the Dtd's are extracted from the DOCTYPE information and downloaded from the server. They are then cached locally, so the DTD validation is very quick.


I hope you'll find my contribution useful.

Thank you for a very good library.


Best regards,


Guillaume ARRECKX


Attachment: dtdvalidator.cpp
Description: Binary data

Attachment: dtdvalidator.h
Description: Binary data

Attachment: istreamparserinputbuffer.cpp
Description: Binary data

Attachment: istreamparserinputbuffer.h
Description: Binary data

Attachment: parserinputbuffer.cpp
Description: Binary data

Attachment: parserinputbuffer.h
Description: Binary data

Attachment: validator.cpp
Description: Binary data

Attachment: validator.h
Description: Binary data


--- End Message ---


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]