[XML-SIG] PyXML, 4suite, libxml2... what should I choose?
Uche.Ogbuji at fourthought.com
Sun Dec 5 23:13:21 CET 2004
On Mon, 2004-11-29 at 19:34 +0000, Frans Englich wrote:
> I need some guidance for the various XML implementations.
Well, at the minimum you'll get argument :-)
> In my project I use the Python DOM classes for instantiations of my XML data,
> and I need XPath functionality,
4Suite has an XPath implementation that is very easy to use and makes
extending XPath with functions implemented in Python very simple.
> WXS validation,
4Suite does not support WXS. Advantage libxml2 here. Then again, if
you have a choice in the matter you really should consider using RELAX
NG instead, which is superior to WXS and is supported by 4Suite.
> and XSLT processing.
4Suite's XSLT processor is also easy to use and extend.
> Currently, I pipe out my structures to libxml2/libxslt's xmllint/xsltproc for
> doing validation, and XSLT processing. libxml2 is capable, but the solution
> is ugly, and slow(de-serialization/serialization). In addition, I lack XPath
> functionality. I have no intentions to skip Python's XML structures, and use
> for example libxml2's.
Out of curiousity, by "Python's XML structures" do you mean minidom? If
so, what motivates this reservation? I should add the disclaimer that
4Suitee's XPath and XSLT features require Domlette rather than minidom.
Domlette is very similar to minidom (much more so than libxml2's DOM-
like structures). Domlette is also IMO as pythonic as you can get and
still be DOM-like (more Pythonic and you're into the territory of
ElementTree and data bindings such as Anobind, GenerateDS and Gnosis
> So, my plan is to get XPath somewhere, and perhaps be able to substitute
> libxml2 for something more Pythonic while I'm at it.
You should at least give 4Suite a try if this is your bottom line.
> From what I can tell, there is three major packages to keep an eye on: 1)
> standard Python; 2) PyXML; 3) 4suite. Let me see if I got this straight:
> * Python have _no_ XPath implementation (right?)
> * PyXML install an XPath implementation(written by fourthought) into Python's
> package xml(xml.xpath). Is it version 1.0? Is it robust and stable?
It's pretty robust and stable. It is based on very old code from
4Suite's XPath and the latter has been optimized a great deal and has
added a lot of useful features.
> * PyXML has xml.xslt; not an option since it's not stable/production quality,
> according to the docs -- or what is its status? How much "experimental" is
Basing XSLT on plain DOM is a bit tricky, which is why in 4Suite we've
settled on Domlette-only. It will take a lot of work to get Python's
xml.xslt compliant and efficient while still using plain old minidom.
Again, it's based on old code from 4Suite which has been much optimized
and otherwise improved since then.
> * 4suite has XPath(another implementation written by fourthought..?) and
> robust xslt.
It's a much newer version of the XSLT in PyXML.
> * Neither PyXML nor 4suite has a W3C XML Schema stack, so I'll have to look
> elsewhere; one alternative is XSV but it brings in addition a dependency on
> PyLTXML. Looks like continuing to pipe to libxml2's xmllint(or link) is still
> the best alternative.
I suppose another option is to use Trang to convert WXS to RELAX NG and
then use XVIF or 4Suite.
> What is the best option(s) for me? With my interest of keeping the
> dependencies down, should I go for PyXML-XPath + PyXML-XSLT _if_ it's good
> enough or libxslt + libxml2-WXS? I could use 4suite's XSLT, but since I
> nevertheless will have a dependency on libxml2/libxslt for WXS I can use
> that(and eat the speed penalty).
> Important is it has a future(maintained..) and is stable/trustable.
> What should I go for, and what have I missed?
> BTW, is there any plans to merge any XSLT/XPath stack into vanilla Python?
> (when?) It's functionality often needed, AFAICT.
XPath is a little language, and XSLT a not-so-little one, so I'd expect
they're too much to stuff into core Pylib, even with the "batteries
included" philosophy. Add to that the fact that something a bit richer
than minidom would be needed for the data model (if the implementation
is to be at all efficient) and I'd say it's a stretch.
> Yes, I'm new on the Python & XML front..
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.net http://4Suite.org http://fourthought.com
Use CSS to display XML - http://www.ibm.com/developerworks/edu/x-dw-x-xmlcss-i.html
Location, Location, Location - http://www.xml.com/pub/a/2004/11/24/py-xml.html
The State of Python-XML in 2004 - http://www.xml.com/pub/a/2004/10/13/py-xml.html
Be humble, not imperial (in design) - http://www.adtmag.com/article.asp?id=10286
XMLOpen and more XML Hacks - http://www.ibm.com/developerworks/xml/library/x-think27.html
A survey of XML standards - http://www-106.ibm.com/developerworks/xml/library/x-stand4/
More information about the XML-SIG