Recommended validating XML parser?

Stefan Behnel stefan.behnel-n05pAM at web.de
Mon May 7 11:47:39 EDT 2007


Kirk Strauser wrote:
> We're looking for a current, supported, validating XML parser.  Since it
> seems like there are a few thousand out there, I though we'd see what
> everyone else is using.

You are asking for lxml, right?

http://codespeak.net/lxml/


> Bonus points if it can do something like:
> 
>     >>> foo = XMLParser("""
>     <xml>
>         <weight>3000</weight>
>     </xml>
>     """, dtd=file('/etc/weightfile.dtd'))
> 
>     >>> print foo.weight
>     3000
> 
> ...or some variant on that theme.

Not currently supported, only document internal DTD references are used. But
you can always validate the document *after* parsing, be it with DTD,
XMLSchema or RNG.

BTW, adding this would be straight forward. The implementation is there, it's
just not available at the API level (and I'm not sure enough how it should
look like...)

Stefan



More information about the Python-list mailing list