Dirk Meyer wrote: > Duncan Webb wrote: > > Gorka Olaizola wrote: > >> On Thu, Apr 03, 2008 at 09:22:13AM +0200, Gorka Olaizola wrote: > >>> It seems that python should use another implementation of XML at least > >>> in the 1.8.x series. > >> That should read Freevo. Freevo should use another implementation of > >> XML at least in the 1.8.x series. > > I think that we discuss this on the devel list, as IIRC dischi and jason > > did some analysis of xml parsers. > > > > In freevo-1, at the moment there are already several parsers: > > http://pyxml.sourceforge.net/ > > elementtree and > > beautifulsoup. > > The question is: what parts of Freevo/kaa need what kind of xml > parser. All kaa modules should either use xml.dom.minidom or > xml.sax. All parts of our code should work with and without pyxml > installed. I have no idea what the difference is, maybe the xml in > Python 2.5 already is the stuff from pyxml. Beautifulsoup is needed > for web site parsing and should not be used as "normal" xml parser, > elementtree is a nice tree parser. > > I propose for Freevo: use elementtree for parsing based on a tree, sax > From python as sax parser. Stuff like lxml could be used optional as a > fast elementtree replacement.
In your tests is lxml faster that cElementTree? > > Kaa should only use minidom or sax to avoid extra deps. IIRC this is > the case. > > > Rewriting code, just because a library has not been updated, is not one > > of my favourite tasks. > > No, and the python website still points to pyxml as xml lib. > http://docs.python.org/lib/module-xml.dom.html I'm not quite sure what you mean by "No", do you mean that it's not out of date and if so why are distros dropping it? Because its core has been moved into Python? I know from experience that DOM does use a huge amount of memory, something like 20 times the size of the xml file but is easy to use. Nowadays memory is cheap and when someone buys a new PC it will have been specified to run Vista so memory limits are a thing of the past. If I understand the differences between DOM and SAX, the DOM is good for fxd files, where updates to the xml files are required and SAX is good for external data, such as TV.xml, or RSS feeds as it uses less memory and the xml does not need updating. So the remaining question is, are SAX parsers much faster than DOM, if not then I propose that we replace all the xml parsers with ElementTree, then we could use code like: | import sys | if sys.hexversion >= 0x2050000: | import xml.etree.cElementTree as ET | else: | try: | import cElementTree as ET | except ImportError: | import elementtree.ElementTree as ET and if lxml is faster, then this could be used as the first choice. The docs say it uses the same syntax as ElementTree. The fxd parsing code is a bit spread out through the freevo sources, being able to has a single module for all the fxd parsing and updating will be a big help maintaining the code. Duncan ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Register now and save $200. Hurry, offer ends at 11:59 p.m., Monday, April 7! Use priority code J8TLD2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ Freevo-devel mailing list Freevo-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freevo-devel