--- Begin Message ---
- From: "Guillaume Arreckx" <bill arreckx acterna com>
- To: cdevienne users sourceforge net
- Subject: DTD validation for libxml++
- Date: Wed, 31 Mar 2004 16:33:06 +0200
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 dataAttachment: dtdvalidator.h
Description: Binary dataAttachment: istreamparserinputbuffer.cpp
Description: Binary dataAttachment: istreamparserinputbuffer.h
Description: Binary dataAttachment: parserinputbuffer.cpp
Description: Binary dataAttachment: parserinputbuffer.h
Description: Binary dataAttachment: validator.cpp
Description: Binary dataAttachment: validator.h
Description: Binary data
--- End Message ---