ElementTree vs. lxml (python XML libraries)

Shahms King shahms at shahms.com
Thu May 12 20:59:04 UTC 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Daniel Veillard wrote:
| On Thu, May 12, 2005 at 12:34:44PM -0400, John (J5) Palmieri wrote:
|
|>This is just an exploratory e-mail as I don't know all the issues
|>involved and don't want to get into a flamewar if someone has strong
|>opinions on either side.
|>
|>I have been looking at what library to use for parsing the XML content
|>in the dbus python bindings.  Suggestions were to use lxml
|
|
|   why not libxml2 python bindings directly ? At least if you have a
| problem I know the full stack there.
|
| Daniel
|

This is just a summary from the last time this dicussion came up, some
of the details may be incorrect.  I happen to like libxml2 and would try
to fix these problems "If I Only Had The Time".

1. The bindings are very un-pythonic.  The biggest wart off the top of
~   my head is that you have to manually free the document. The lxml
~   wrapper is an attempt to fix this problem.

2. "They are slow".  As much as libxml2 is usually faster than expat,
~   but something about how the python bindings deal with strings makes
~   libxml2 slower in this case.


There may have been a third, but those two are the biggest problems that
I remember. As for lxml not implementing the "iterparse" interface, I'd
need to look into it more, but I'm pretty sure lxml could use libxml's
XmlTextReader interface to implement this...

- --
Shahms E. King <shahms at shahms.com>
Multnomah ESD

Public Key:
http://shahms.mesd.k12.or.us/~sking/shahms.asc
Fingerprint:
1612 054B CE92 8770 F1EA  AB1B FEAB 3636 45B2 D75B
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFCg8OY/qs2NkWy11sRArYQAKCTxp1tu7pF4BJm5HX8VImXwX1X2ACglyX8
ChyrWxymMEGmo32oH1ElHV0=
=hbGR
-----END PGP SIGNATURE-----




More information about the fedora-devel-list mailing list