The JAXP XPath API
Saxon provides an API for executing XPath expressions. The API is an implementation of the JAXP 1.3
XPath API, which in turn is loosely modeled
on the DOM Level 3 API for XPath (which Saxon does not implement).
For full documentation, see the Javadoc description of package
net.sf.saxon.xpath. Two sample applications using this API are available: they are called
and can be found in the
XPathExample.java application is written
to use JAXP 1.3 interfaces. To run this application, see the instructions
in Shakespeare XPath Sample Application.
ApplyXPathJAXP.java application is an enhanced version of the class of the
same name issued as a sample application in the JAXP 1.3 distribution. It has been enhanced to show
the use of more advanced features, such as the ability to bind namespaces, variables, and functions, and
also to demonstrate use of the XPath API with different object models.
The XPath API in Saxon predates the introduction of the JAXP 1.3 XPath API, so it contains some facilities
that are obsolescent. However, there are also differences caused by the fact that Saxon supports
XPath 2.0, with its richer data model, whereas JAXP 1.3 operates only on XPath 1.0.
The following sections describe use of the XPath API in more detail.