Module path
Basic support for evaluating XPath expressions against streams.
>>> from genshi.input import XML
>>> doc = XML('''<doc>
... <items count="4">
... <item status="new">
... <summary>Foo</summary>
... </item>
... <item status="closed">
... <summary>Bar</summary>
... </item>
... <item status="closed" resolution="invalid">
... <summary>Baz</summary>
... </item>
... <item status="closed" resolution="fixed">
... <summary>Waz</summary>
... </item>
... </items>
... </doc>''')
>>> print(doc.select('items/item[@status="closed" and '
... '(@resolution="invalid" or not(@resolution))]/summary/text()'))
BarBaz
Because the XPath engine operates on markup streams (as opposed to tree
structures), it only implements a subset of the full XPath 1.0 language.
|
Path
Implements basic XPath support on streams.
|
|
PathSyntaxError
Exception raised when an XPath expression is syntactically incorrect.
|