[PyKDE] Re: [lxml-dev] ANN: XPathEvaluator 0.1.0

Andreas Pakulat apaku at gmx.de
Sat Jun 3 18:24:03 BST 2006


On 01.06.06 23:51:15, Andreas Pakulat wrote:
> as per Stefan's request I'm announcing here (and on the PyQt mailing
> list) the first release of a small tool I "just" (i.e. the last 3 days)
> wrote.
> 
> XPathEvaluator is a tool to test what results a XPath expression gives
> you when executed on a specific XML file. With the help of lxml it can
> also parse pretty broken (and of course correct) HTML files. It loads
> it's data from URLs if you want and highlights all nodes that an XPath
> evaluation returns so you can easily identify them.
> 
> I couldn't use lxml for more than HTML parsing because there's
> unfortunately no easy way to find out the element to which an attribute
> result or text result belongs to. I might actually use lxml for the
> initial XML parsing too, because it's way faster than the PyXML parser I
> currently have.
> 
> I hope somebody finds this useful, I might add new features in the
> future, however there's no priority at the moment for the development of
> XPathEvaluator. As always with open source software: Patches welcome.
> 
> XPathEvaluator can be downloaded from:
> http://www.apaku.de/linux/xpathevaluator/index.php
> That page also mentions all required software.

I just "released" version 0.2.0, which now supports 3 different parsing
methods and 2 different xpath implementations:

1. Plain PyXML, this is relatively slow compared to lxml, but it
supports highlighting of any node in the tree.
2. lxml->PyXML, this uses lxml to parse the input and the traverses the
lxml ElementTree building a PyXML DOM out of it. This proves to build
already faster than 1 for rather small xml files. It also supports the
hightlighting of any tree node
3. Plain lxml, I guess this is the fastest parsing and XPath
implementation (it's not visibly faster at parsing than 2 here with my
small xml files), however only element nodes that are contained in an
XPath result are highlighted. So if your XPath result is a Attribute
value or some kind of text you won't see anything.

I'm planning to release 0.3.0 about next weekend, that version will show
errors on a separate tab and will also present the output of the xpath
evaluation on a tab, possibly linked to the tree.

Andreas

-- 
Generosity and perfection are your everlasting goals.




More information about the PyQt mailing list