[lxml-dev] Validation against an external DTD

Lee Brown lee.brown at elecdev.com
Tue Feb 6 21:52:44 CET 2007


Greetings!

>>> help(etree.XMLParser)
Help on class XMLParser:

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.
 |  
 |  The keyword arguments in the constructor are mainly based on the libxml2
 |  parser configuration.  A DTD will also be loaded if validation or
 |  attribute default values are requested.
 |  
 |  Available boolean keyword arguments:
 |  * attribute_defaults - read default attributes from DTD
 |  * dtd_validation     - validate (if DTD is available)
 |  * load_dtd           - use DTD for parsing
 |  * no_network         - prevent network access
 |  * ns_clean           - clean up redundant namespace declarations
 |  * recover            - try hard to parse through broken XML
 |  * remove_blank_text  - discard blank text nodes 

-----Original Message-----
From: lxml-dev-bounces at codespeak.net [mailto:lxml-dev-bounces at codespeak.net] On
Behalf Of Michael Guntsche
Sent: Tuesday, February 06, 2007 3:47 PM
To: lxml-dev at codespeak.net
Subject: Re: [lxml-dev] Validation against an external DTD

Hello,

Since I did not get any answer and the maillinglist seems to be a little bit
more alive I am asking again.
Is it possible to extend lxml to validate against external DTDs the same way as
it is possible with relax-ng and xsd files now?
I have to validate against both (DTDs and XSDs) in the near future and I would
prefer to use only ONE xml library and not pyxml and lxml together.

Kind regards,
Michael

On Jan 30, 2007, at 12:59 PM, mike at it-loops.com wrote:

> Hello,
>
> I read through the documentation and I did not find a way to validate 
> an XML-File against an external DTD with lxml. I searched the ML- 
> archive and found several posts but I still do not know exactly, if 
> this functionality is available or not.
<snip>
_______________________________________________
lxml-dev mailing list
lxml-dev at codespeak.net
http://codespeak.net/mailman/listinfo/lxml-dev



More information about the lxml-dev mailing list