XPath support?

Diez B. Roggisch deets at nospam.web.de
Sun Aug 16 16:31:24 EDT 2009


kj schrieb:
> I'm looking for a XML parser that produces an object with full
> XPath support.  What I've been using up to now, xml.etree.ElementTree,
> fails to support Xpath predicates, as in "spam[@eggs='3']/ham".
> 
> What I'm trying to do is to read-in a large XML string, and parse
> it into an object from which I can extract nodes matching selectors
> that include such predicates.
> 
> Any suggestions would be greatly appreciated.

Try lxml. It's element-tree compatible, and supports xpath.

Diez



More information about the Python-list mailing list