Edgewall Software

Changes between Initial Version and Version 1 of MarkupPath


Ignore:
Timestamp:
Jul 31, 2006, 8:03:52 PM (18 years ago)
Author:
cmlenz
Comment:

Initial version

Legend:

Unmodified
Added
Removed
Modified
  • MarkupPath

    v1 v1  
     1= Using XPath in Markup =
     2
     3Markup provides basic [http://www.w3.org/TR/xpath XPath] support for matching and querying event streams.
     4
     5== Limitations ==
     6
     7Due to the streaming nature of the processing model, Markup uses only a subset of the [http://www.w3.org/TR/xpath XPath 1.0] language.
     8
     9In particular, only the following axes are supported:
     10 * `attribute`
     11 * `child`
     12 * `descendant`
     13 * `descendant-or-self`
     14 * `namespace` (not completed yet)
     15 * `self`
     16
     17In addition, Markup does not (yet) support numeric types in XPath: everything is treated as text or booleans. For that reason, [http://www.w3.org/TR/xpath#NT-RelationalExpr relational] or [http://www.w3.org/TR/xpath#NT-AdditiveExpr additive] operators such as `>`, `<`, or `<=`.
     18
     19== Querying Streams ==
     20
     21{{{
     22#!python
     23from markup.input import XML
     24
     25doc = XML('''<doc>
     26 <items count="2">
     27      <item status="new">
     28        <summary>Foo</summary>
     29      </item>
     30      <item status="closed">
     31        <summary>Bar</summary>
     32      </item>
     33  </items>
     34</doc>''')
     35print doc.select('items/item[@status="closed"]/summary/text()')
     36}}}
     37
     38This would result in the following output:
     39
     40{{{
     41#!xml
     42Bar
     43}}}
     44
     45== Matching in Templates ==
     46
     47See MarkupTemplates#py:match
     48
     49----
     50See also: MarkupGuide, MarkupStream