Packages

package xpath

Type Members

  1. class XPath extends AnyRef

    Represent a subset of XPath XML path syntax for use in identifying nodes in parse trees.

    Represent a subset of XPath XML path syntax for use in identifying nodes in parse trees.

    Split path into words and separators / and // via ANTLR itself then walk path elements from left to right. At each separator-word pair, find set of nodes. Next stage uses those as work list.

    The basic interface is XPath#findAll(tree, pathString, parser). But that is just shorthand for:

    `[[XPath]]` p = new `[[XPath#XPath XPath]]`(parser, pathString);
    return p.`[[#evaluate evaluate]]`(tree);
    

    See org.antlr.v4.test.TestXPath for descriptions. In short, this allows operators:

    <dl> <dt>/</dt>

    root
    <dt>//</dt>
    anywhere
    <dt>!</dt>
    invert; this must appear directly after root or anywhere operator
    </dl>

    and path elements:

    <dl> <dt>ID</dt>

    token name
    <dt>'string'</dt>
    any string literal token from the grammar
    <dt>expr</dt>
    rule name
    <dt>*</dt>
    wildcard matching any node
    </dl>

    Whitespace is not allowed.

  2. abstract class XPathElement extends AnyRef
  3. class XPathLexerErrorListener extends BaseErrorListener
  4. class XPathRuleAnywhereElement extends XPathElement

    Either rulename at start of path or ...//rulename in middle of path.

  5. class XPathRuleElement extends XPathElement
  6. class XPathTokenAnywhereElement extends XPathElement

    Either ID at start of path or ...//ID in middle of path.

  7. class XPathTokenElement extends XPathElement
  8. class XPathWildcardAnywhereElement extends XPathElement
  9. class XPathWildcardElement extends XPathElement

Ungrouped