DOM Level 3 includes an optional XPath module in the org.w3c.dom.xpath
package.
The feature string "XPath" with the version "3.0" tests for the presence of this module. For example,
if (!impl.hasFeature("XPath", "3.0")) {
System.err.println("This DOM implementation does not support XPath");
return;
}
An
XPathEvaluator
object processes an XPath expression
and returns an XPathResult
.
In DOM implementations that support XPath, the same classes that implement
org.w3c.dom.Document
implement XPathEvaluator
.
No special constructor or factory class is required. Just cast the Document
object you want to query to XPathEvaluator
.