[lxml-dev] ElementTree 1.3a xpath position broken?
Richard Baron Penman
richardbp+lxml at gmail.com
Sun Jan 31 14:56:01 CET 2010
hi Stefan,
thanks very much for your reply.
> > I am after xpath support for an application running on Google App Engine,
> > which unfortunately rules out lxml.
>
> Yeah, I know. That's one of the reasons I never found a use for the GAE on
> my side. That also makes your e-mail somewhat misplaced on this list. ;)
>
Hopefully the lxml feature request goes somewhere:
http://code.google.com/p/googleappengine/issues/detail?id=18
Can you recommend an alternative for discussing ElementTree?
I tried emailing Fredrik earlier but didn't get a response and the
ElementTree repository hasn't been committed to since 2007.
http://sourceforge.net/projects/pdis-xpath/
>
> I never tried it, but it's been recently updated, so it looks like it's
> still maintained.
>
That project does look promising, however it doesn't yet support // or ..
> > However tag positions appear to be broken:
> >>>> print list(tree.findall('.//b[1]')) # should return b element
> > []
>
> That shouldn't be hard to add. You just have to make sure it only counts
> elements within the same parent, so you may have to add the selector in
> more than one place. I guess that's why Fredrik didn't add it while he was
> at it.
>
I found it was half implemented and finished it off. There is some elegant
code in ElementPath.py but it needs refactoring...
Richard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://codespeak.net/pipermail/lxml-dev/attachments/20100201/b9645364/attachment.htm
More information about the lxml-dev
mailing list