[lxml-dev] Validation against an external DTD
Michael Guntsche
mike at it-loops.com
Tue Feb 6 22:21:06 CET 2007
On Feb 6, 2007, at 9:52 PM, Lee Brown wrote:
>
> class XMLParser(_BaseParser)
> | The XML parser. Parsers can be supplied as additional argument to
> | various parse functions of the lxml API. A default parser is
> always
> | available and can be replaced by a call to the global function
> | 'set_default_parser'. New parsers can be created at any time
> without a
> | major run-time overhead.
I had a look at this as well, but I do not understand, how I specify
the DTD that should be used for validation. I unterstand that the
Parser validates against a DTD if it is specified in the XML file and
found by the parser during execution. But in my case I need something
like this
PyXML example:
dtd = xmldtd.load_dtd("my dtd file")
parser = xmlproc.XMLProcessor()
parser.set_application(xmlval.ValidationApp(dtd, parser))
....
parser.parse_file("my xml file that needs to be validated")
Kind regards,
Michael
More information about the lxml-dev
mailing list