[Chicago] python and xml

Ian Bicking ianb at colorstudy.com
Mon Jun 5 23:36:34 CEST 2006


Tim Saylor wrote:
> Hello,
> 
> I've been using python for a few years now but I'm new to the chipy
> group.  I'm hoping someone can help me out with this problem since
> I've had little luck with google so far.
> 
> I'm looking for a validating xml dom parser library in python.
> Information's been hard to find so I'm not even 100% sure what all the
> current choices are.  At the moment I'm using the expat parser in
> PyXML and that's great except that it dies on the line """<DOCTYPE
> ServiceSelectors SYSTEM "services.dtd">""".  It seems that it doesn't
> understand the SYSTEM keyword and chokes, but I found out that even if
> I fixed that part of the code it wouldn't validate anyway.
> 
> So if anyone's familiar with the status of xml parsing in python,
> please help me out.

4DOM/4Suite seems like the most technically accurate of the systems, so 
I assume they have some validation.  lxml (based on libxml2) might also 
have some validation; I don't really know, except that it seems to have 
a wider variety of X* features than many other systems.  Apparently 
libxml2/lxml can be a bear to install sometimes, which would be the 
downside.  But it's really fast; the 4* tools tend to be a bit slow.

The xml.* modules are kind of crap, IMHO.  ElementTree doesn't do 
validation.  Those two plus the ones I mention above seem to be the top 
tier/most viable libraries.



More information about the Chicago mailing list