[XML-SIG] no 'writexml' when building a domTree from ext.Sax2

Fredrik Lundh fredrik at pythonware.com
Wed May 3 14:19:44 CEST 2006


Alexandre CONRAD wrote:
> I would prefer using python's standard module library rather than
> installing 3rd party tools. Speed (faster than 4DOM would be a good
> start) is one of my priorities. I'm also using XPath for parsing (not
> always though).

speed and no 3rd party tools aren't exactly compatible requirements.  however,
if it's okay for you to ship one or two python modules with your application, you
could use the ElementTree and ElementPath modules from the ElementTree kit,
together with Python's pyexpat.

    http://effbot.org/zone/elementtree.htm

by itself, ElementTree is a bit faster than most other DOM implementations.  if
you add the cElementTree module (a standard component on many modern
Linux systems), you'll end up with something that can read XML files faster
than Python can read text files:

    http://effbot.org/zone/celementtree.htm#benchmarks

ET is a bit limited in the XPath department, though.  if you want reasonable
speed and full XPath support (and a *lot* more), see http://codespeak.net/lxml/

</F> 





More information about the XML-SIG mailing list