[Twisted-Python] Status of twisted.xish.xpath
matt at pollenation.net
Tue Apr 13 20:33:53 EDT 2004
On Mon, 2004-04-12 at 16:59, Dave Smith wrote:
> > I was wondering what's the status of the xpath parser in Twisted.
> Well, xish.xpath isn't meant to be a "full" xpath implementation, per se.
> I originally wrote it be used for routing XML packets from a Jabber
> connection, so it's really focused on providing matching/equality
> operations versus the transforms and other operations traditionally
> associated with XPath engines. In my happy little world, XPath is not a
> operational language -- it's a filtering/matching syntax.
Agreed. Anything more than filtering/matching and xpath becomes really
ugly. Just look at some of the latter examples in the Zvon.org tutorial
> I wasn't aware that Nevow was using xish.xpath, but that's cool if it is.
Nevow itself doesn't use xish.xpath (yet, but see dp's post) but an
example I committed to the Nevow repository uses it to extract bits from
an RSS feed. The code is in sandbox/mg/rsschannel.py if anyone's
interested although Valentino (aka Dialtone) has taken that and extended
> I'll be glad to add additional logic as necessary to enhance the
> filtering/matching aspects of XPath to support a RSS aggregator, but I'd
> prefer to not see xish.xpath become a "full" XPath engine.
I agree, keep it simple. xish.xpath worked well in my example although
there seem to be a couple of things missing that would be useful.
Specifically, support for // and support for matching on attribute
Attached is a unittest that tests examples 1 to 5 of the zvon.org
tutorial (plus a couple of other tests). I am not 100% that the code is
bug free or that the tests are entirely correct but please use it if it
looks useful. If xish.xpath supported all those matching mechanisms then
it would be complete enough for anything I can think of right now. I
would rather use Python for the rest anyway. Oh, matching by attribute
value (zvon's example 6) might be useful too, but not the
Hope this is useful.
/ \__ Matt Goodall, Pollenation Internet Ltd
\__/ \ w: http://www.pollenation.net
__/ \__/ e: matt at pollenation.net
/ \__/ \ t: +44 (0)113 2252500
/ \ Any views expressed are my own and do not necessarily
\__/ reflect the views of my employer.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 6295 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20040414/dd74b878/attachment.py
More information about the Twisted-Python