<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="../make-menu.xsl" type="text/xsl"?><html>
   <head>
      <this-is section="xpath-api" page="jaxp-xpath" subpage=""/>
      <!--
           Generated at 2011-12-09T20:47:22.916Z--><title>Saxonica: XSLT and XQuery Processing: The JAXP XPath API</title>
      <meta name="coverage" content="Worldwide"/>
      <meta name="copyright" content="Copyright Saxonica Ltd"/>
      <meta name="title" content="Saxonica: XSLT and XQuery Processing: The JAXP XPath API"/>
      <meta name="robots" content="noindex,nofollow"/>
      <link rel="stylesheet" href="../saxondocs.css" type="text/css"/>
   </head>
   <body class="main">
      <h1>The JAXP XPath API</h1>
      <p>Saxon implements the JAXP 1.3 API for executing XPath expressions as defined in package
<code>java.xml.xpath</code>, which is a standard part of the Java class library since JDK 1.5. 
 Three sample applications using this API are available: they are called
 <code>XPathExample.java</code>, <code>XPathExampleSA.java</code>, and <code>ApplyXPathJAXP.java</code>,
and can be found in the <code>samples/java</code> directory after downloading the <code>saxon-resources</code> archive.</p>
      <p>To run the <code>XPathExample.java</code> application, see the instructions
in <a class="bodylink" href="../samples/shakespeare.xml">Shakespeare XPath Sample Application</a>.</p>
      <p>The <code>XPathExampleSA.java</code> application demonstrates use of schema-aware XPath. It is designed
to be used with the files <code>books.xml</code> and <code>books.xsd</code> in the directory <code>samples/data</code>.</p>
      <p>The <code>ApplyXPathJAXP.java</code> 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.</p>
      <p>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. </p>
      <p>The following sections describe use of the XPath API in more detail.</p>
      <ul>
         <li>
            <p><a class="bodylink" href="jaxp-xpath/factory.xml">Selecting the XPath implementation</a>: Describes how to ensure that Saxon is selected as the XPath API implemenation</p>
         </li>
         <li>
            <p><a class="bodylink" href="jaxp-xpath/context-node.xml">Setting the context item</a>: Describes how to supply a context item</p>
         </li>
         <li>
            <p><a class="bodylink" href="jaxp-xpath/return-types.xml">Return types</a>: Describes the mapping of XPath return types to Java classes</p>
         </li>
         <li>
            <p><a class="bodylink" href="jaxp-xpath/saxon-additions.xml">Additional Saxon methods</a>: Describes features of the Saxon implementation additional to the JAXP specification</p>
         </li>
         <li>
            <p><a class="bodylink" href="jaxp-xpath/jaxp-xpath-extension-functions.xml">Calling JAXP XPath extension functions</a>: Describes how to call out from XPath expressions to Java code</p>
         </li>
      </ul>
      <table width="100%">
         <tr>
            <td>
               <p align="right"><a class="nav" href="jaxp-xpath/factory.xml">Next</a></p>
            </td>
         </tr>
      </table>
   </body>
</html>