Package com.werken.xpath
Class XPath
java.lang.Object
com.werken.xpath.XPath
Main run-time interface into the XPath functionality
The XPath object embodies a textual XPath as described by the W3C XPath specification. It can be applied against a context node (or nodeset) along with context-helpers to produce the result of walking the XPath.
Example usage:
// Create a new XPath
XPath xpath = new XPath("a/b/c/../d/.[@name="foo"]);
// Create the ContextSupport
ContextSupport helper = new ContextSupport();
// Use the XPathFunctionContext instance as the implement
// for function resolution.
helper.setFunctionContext( XPathFunctionContext.getInstance() );
// Apply the XPath to your root context.
Object results = xpath.applyTo(helper, myContext);
- Author:
- bob mcwhirter (bob @ werken.com)
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapplyTo
(ContextSupport contextSupport, List nodes) Apply this XPath to a list of nodesapplyTo
(ContextSupport contextSupport, org.jdom.Document doc) applyTo
(ContextSupport contextSupport, org.jdom.Element node) Apply this XPath to a single root nodeapplyTo
(org.jdom.Document doc) applyTo
(org.jdom.Element node) Retrieve the textual XPath string used to initialize this ObjecttoString()
-
Constructor Details
-
XPath
Construct an XPath
-
-
Method Details
-
toString
-
getString
Retrieve the textual XPath string used to initialize this Object- Returns:
- The XPath string
-
applyTo
-
applyTo
-
applyTo
-
applyTo
-
applyTo
Apply this XPath to a list of nodes- Parameters:
contextSupport
- Walk-assisting statenodes
- Root NodeSet context
-
applyTo
Apply this XPath to a single root node- Parameters:
contextSupport
- Walk-assisting statenode
- The root context node
-