xml-conduit-selectors-0.2.0.0: jQuery-style CSS selectors for xml-conduit
Safe HaskellNone
LanguageHaskell2010

Text.XML.Selectors.ToAxis

Description

 
Synopsis

Documentation

toAxis :: Selector -> Axis Source #

Turn a Selector into an Axis.

match :: Selector -> Cursor -> [Cursor] Source #

Directly apply a Selector to a Cursor, removing duplicates. Cursors are considered duplicate iff their focus node and ancestory are the same.

Due to the knot-tying of the Cursor type, this is not perfect: we are not considering the focus node's position within its parent, so any two nodes that are exactly identical themselves and share ancestory will be considered equal. E.g., in the following XML document:

<root>
  <parent>
     <child>Foo</child>
     <child>Foo</child>
  </parent>
</root>

...the two <child/> nodes will be considered equal, even though they are two distinct nodes in the DOM.

Unlike toAxis, the match function prepends an implicit self-or-descendant Axis to the selector in order to mimic the behavior of actual CSS selectors.