Dirk Meyer wrote: > Martijn Faassen wrote: >> As the original author of lxml I might have a few comments. > > Hi :) > >> xml.minidom >> >> API: standard-ish as DOM, but is not very Pythonic >> Performance: slow in comparison, gobbles up memory >> Features: just a tree, that's it. >> Ease of installation: in standard library > > But very slow. It could be used for fxd files because they are > small. Huge tasks like XMLTV is a no go. In kaa we use it for the > config.cxml files which are very small. > >> xml.sax >> >> API: standard as SAX, but very low-level so relatively hard to work with >> Performance: high - I haven't measured the SAX parser in the standard >> library, but it's probably more than adequate for most purposes. Low >> memory usage. >> Features: almost nothing, just low-leve SAX events >> Ease of installation: in standard library > > SAX is used in kaa when the whole DOM is not needed. E.g. kaa.epg uses > SAX to parse the XMLTV file. There is no need to keep everything in > memory, only one programm and we put it into the db. If the complete > tree is needed, SAX is a no-go. > >> ElementTree >> cElementTree: >> lxml
(c)ElementTree has been included in Python since 2.5. Originally, I missed the benchmark page on the lxml site (http://codespeak.net/lxml/performance.html) which is quite detailed and basically says that lxml is faster than ElementTree is all tests but cElementTree is often faster than lxml but for specific cases is slower. > For Freevo this may be the best choice. If we only use the ElementTree > API, we could check for all three in the order of performance (I guess > the list above in reverse order). So the user needs only one extra > package installed. > >> Features: tons of features. xpath is *very* useful when reading in XML. >> XSLT, schemas, fast messy HTML parser support, etc. > > I do not think we need that. It's likely that xpath is needed for external sources. >> Ease of installation: harder. C compiler needed (except on Windows). >> libx2ml/libxslt installation needed (except on Windows, it's bundled). >> On Linux usually installation is easy enough as C compiler is available >> and recent enough version on libxml2 is typically installed. On Mac OS >> they install a version that is some years old and too old, so more >> installation effort is needed. > > That is the problem of the distro. If all distros have lxml I have no > problem with making it a requirement. > > Duncan: what parts of Freevo need XML? BeautifulSoup is used for IMDB's HTML, and it seems to be resilient to minor changes in IMDB pages. There are two sources of XML that freevo uses, internal and external. Internal include: fxd files and games. External include: TV.xml, Amazon, weather data, movie covers, youtube, flickr and possibly podcasts. (IIRC pod casts are being parsed by regular expressions). The worst bits are the fxd files and rss feed data. fxd files because the parsing code is spread about in the sources and rss feed data because it uses regular expressions. IIRC, Tanja said that she was going to consolidate the audio podcast plug-ins as there are two that do the same thing. I would like to extend the fxd files so that specific options can be used for different players. This will remove the qp_xml requirement. So this would be allowed: | <?xml version="1.0" ?> | <freevo generated="false"> | <movie title="Batman: Dead End"> | <cover-img>batman.jpg</cover-img> | <video> | <file id="file1">Batman_Dead_End.mpg | <mplayer> | <option name="vf" value="crop=704:272:8:102"/> | <option name="vf" value="scale=720:576"/> | </mplayer> | </file> | </video> | </movie> | </freevo> (The generated option would disable the "delete info" menu option) 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