All you have to do is use a parser that has DTD validation enabled: option, which loads the DTD and weaves attribute default values into the document.Again, no validation is performed unless explicitly requested.Otherwise what use is it to know that the XML the application is about to process is valid with regards to some schema?
#include // elided imports // first, two callbacks that display errors - you could probably use // fprintf instead.
Andrew PS This is on Cent OS 5.4, although I had to install libxml from https://github.com/projecthydra/libxml2 to handle my particular schema.
Welcome to my blog, which was once a mailing list of the same name and is still generated by mail.
Eclectic experience in fields like: numerical computing; Python web; Java enterprise; functional languages; GPGPU; SQL databases; etc.
This entry was posted on Monday, March 15th, 2010 at am and is filed under XML, C .
You can follow any responses to this entry through the RSS 2.0 feed.
Also, logging and handling of failures is incomplete.
But anyway, just to get there has taken fair amount of effort, so here's the code, in case it will help anyone else (some parts removed to protect the innocent - mainly logging).
At that point, hopefully, I will (1) have a good starting point and (2) understand libxml2 much more than I do right now.
Since the document has a schema I am bootstrapping myself by creating an empty document, testing it, and then adding elements etc as needed until it validates.
lxml also provides support for ISO-Schematron, based on the pure-XSLT skeleton implementation of Schematron: There is also basic support for The parser in lxml can do on-the-fly validation of a document against a DTD or an XML schema.