[XML-SIG] lxml 1.3 released

Stefan Behnel stefan_ml at behnel.de
Sun Jul 1 17:38:36 CEST 2007


Hi,

Gloria W wrote:
> There's no chance of getting an extension to this module which supports
> DOM2, is there? I cannot work with the current PyXML DOM2 support. It is
> inflexible (does not allow subtree construction/insertion), is buggy,
> and bloated.

Well, "bloat" is a word I would use for any DOM implementation.

lxml is actually quite the opposite of the three: extremely flexible, safe and
simple.


> I wrote my own, but I don't have time to implement the
> range() functionality. Let me know if there are plans to extend this. It
> would be great.

No. lxml will not support the DOM API. It already has a (mostly?) equivalent
API that is much simpler in spirit (and thus much easier to use), so there is
no reason for us to take the step back to the impressively un-pythonic DOM API.

If you really want a W3C-DOM compatible API and want to use libxml2, there is
a project that implements DOM on top of them: libxml2dom.

http://www.boddie.org.uk/python/libxml2dom.html

I assume this is for porting existing code? But even then, you may consider
rewriting the XML parts in lxml. We had a couple of comments on the list that
make me believe that this is a) not that hard (depending on your code
size/architecture) and b) worth it, at least in the cases I heard about.

Oh, and for the really hard-to-port stuff, you can still use Python's DOM support:

http://codespeak.net/lxml/sax.html

Stefan


More information about the XML-SIG mailing list