![](https://secure.gravatar.com/avatar/0442742785857428ccc6929a5c09143a.jpg?s=120&d=mm&r=g)
Greetings! I do not know if lxml can load a DTD from an external file. And the docinfo attributes on the etree instance are read-only, so there's no help there. As a workaround, though, you might be able to prepend a DOCTYPE string to the beginning of the file before you parse it. -----Original Message----- From: lxml-dev-bounces@codespeak.net [mailto:lxml-dev-bounces@codespeak.net] On Behalf Of Michael Guntsche Sent: Tuesday, February 06, 2007 4:21 PM To: lxml-dev@codespeak.net Subject: Re: [lxml-dev] Validation against an external DTD 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 _______________________________________________ lxml-dev mailing list lxml-dev@codespeak.net http://codespeak.net/mailman/listinfo/lxml-dev