package xpath
Type Members
- 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.
- abstract class XPathElement extends AnyRef
- class XPathLexerErrorListener extends BaseErrorListener
- class XPathRuleAnywhereElement extends XPathElement
Either
rulename
at start of path or...//rulename
in middle of path. - class XPathRuleElement extends XPathElement
- class XPathTokenAnywhereElement extends XPathElement
Either
ID
at start of path or...//ID
in middle of path. - class XPathTokenElement extends XPathElement
- class XPathWildcardAnywhereElement extends XPathElement
- class XPathWildcardElement extends XPathElement