Saxonica.com

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 XPathExample.java and ApplyXPathJAXP.java, and can be found in the samples/java directory.

The XPathExample.java application is written to use JAXP 1.3 interfaces. To run this application, see the instructions in Shakespeare XPath Sample Application.

The 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.

Because the XPath API in Saxon predates the introduction of the JAXP 1.3 XPath API, there is often more than one way of achieving the same effect. It is likely that in time, some of the native Saxon methods will be deprecated and replaced by the standard JAXP methods.

The following sections describe use of the XPath API in more detail.

Next