Sat Jan 08 2005 11:12 lxml.etree is getting there:
The lxml.etree implementation of ElementTree, on top of libxml2, is
getting there now. It features automatic memory management and quite a bit of ElementTree compatibility. Not all of the ElementTree API has been implemented yet, but enough for many use cases.
[More]
Wed Jan 12 2005 20:07 lxml parser performance:
In a discussion with Fredrik Lundh about his (c)ElementTree parser
performance benchmarks on the lxml.etree implementation.
[More]
Thu Jan 13 2005 20:33 lxml findall and xpath performance:
Update: lxml got quite a bit faster since this entry, see here
[More]
Fri Jan 14 2005 19:15 lxml progress:
Since some people seem to be actually reading this and some progress has been made, I thought I'd give a report of what's been happening with lxml.
Since last week, I've added a lot more of the ElementTree API, such
as the .find() function and friends, by directly using the code
from ElementTree.
I actually am running the ElementTree and cElementTree test suites
now. I still need to disable some tests, but a significant fraction
is indeed running.
I've improved the way libxml2's parser functionality gets used, in
order to implement libxml2's top-level parse() function.
I've added XPath support to lxml.etree! An example of what you can
do:
>>> from lxml import etree
>>> tree = etree.parse('ot.xml')
>>> tree.xpath('(//v)[5]/text()')
[u'And God called the light Day, and the darkness he called Night.
And the evening and the morning were the first day.\n']
or, say, this, modifying the elements returned:
>>> result = tree.xpath('(//v)[5]')
>>> result[0].text = 'The day and night verse.'
>>> tree.xpath('(//v)[5]/text()')
[u'The day and night verse.']
I've added the start of XSLT support to lxml.etree. An example:
test.xslt
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="*" />
<xsl:template match="/">
<day><xsl:value-of select="(//v)[5]" /></day>
</xsl:template>
</xsl:stylesheet>
>>> from lxml import etree
>>> style_xml= etree.parse('test.xslt')
>>> style = etree.XSLT(style_xml)
>>> ot = etree.parse('ot.xml')
>>> result = style.apply(ot)
>>> style.tostring(result)
u'<?xml version="1.0"?>\n<day>And God called the light Day, and the
darkness he called Night. And the evening and the morning were the
first day.\n</day>\n'
>>> result.getroot().tag
u'day'
[More]
Mon Jan 17 2005 22:31 lxml performance progress:
Such progress a few days can bring. Just last week the lxml.etree
performance figures on ElementTree operations like findall lost
out badly to pure Python code. So badly, it was pretty embarassing:
findall('//v') on ot.xml
ElementTree: 0.13 s
cElementTree: 0.11 s
lxml.etree: 1.9 s
[More]
Tue Jan 18 2005 19:30 a little bit more lxml performance tweaking:
Today I merged the backpointer branch with the lxml trunk, and have
been cleaning up a bit more. In particular I've cleaned up some useless extra subclasses that were only necessary to introduce weak reference support to the various classes. I've now removed these subclasses, which cleans things up a bit more.
[More]
(1) Fri Jan 21 2005 23:46 Relax NG support, C14N:
Some progress over the last few days:
[More]
(3) Mon Jan 24 2005 20:10 benchmarks and lxml:
The recent cElementTree release is causing some waves in the Python/XML community. It started when Uche Ugbuji posted The Python Community has too many deceptive XML benchmarks to his blog.
[More]
Tue Jan 25 2005 20:01 lxml relax NG tweaks:
The Relax NG support seemed to be working for lxml, until I tried it with a complicated case: a modularized XHTML Relax NG schema.
[More]
(2) Sun Jan 30 2005 21:29 About the disdain for XML among Python programmers:
Last december Phillip Eby (PJE) posted a a nice rant. It was
widely quoted in other Python-oriented weblogs; people liked
especially the rant against XML. It was indeed a very nice rant. It still
rankled a bit with me, though, even though I've seen similar things before. This
disdain for XML technologies is very common among Python
programmers. I posted my own rant in response in a comment on
another weblog, hardly a place where it will be seen. So, I'll post a
new, edited version of my rant in my shiny new weblog, where it has at least
a bit more chance to be read. What's the good of ranting if nobody hears you, after all?
[More]
 | Unless otherwise noted, all content licensed by Martijn Faassen under a Creative Commons License. |