<?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="intro" subpage=""/>
      <!--
           Generated at 2011-12-09T20:47:22.916Z--><title>Saxonica: XSLT and XQuery Processing: XPath API for Java</title>
      <meta name="coverage" content="Worldwide"/>
      <meta name="copyright" content="Copyright Saxonica Ltd"/>
      <meta name="title" content="Saxonica: XSLT and XQuery Processing: XPath API for Java"/>
      <meta name="robots" content="noindex,nofollow"/>
      <link rel="stylesheet" href="../saxondocs.css" type="text/css"/>
   </head>
   <body class="main">
      <h1>XPath API for Java</h1>
      <p><b>This section describes how to use Saxon as a Java class library for XPath processing, without making any use
of XSLT stylesheets. It includes information on the XPath API, and the API for the Saxon implementation
of the XPath object model. On other pages you will find 
 <a class="bodylink" href="../using-xsl/embedding.xml">the API for XSLT transformation</a>,
  <a class="bodylink" href="../using-xquery/api-query.xml">the API for running XQuery</a>, and 
  <a class="bodylink" href="../schema-processing/validation-api.xml">the API for Schema validation.</a></b></p>
      <p>For information about the different ways of loading source documents, see
<a class="bodylink" href="../sourcedocs/intro.xml">Handling Source Documents</a>.</p>
      <p>Saxon supports three Java APIs for XPath processing, as follows:</p>
      <ul>
         <li content="para">
            <p>The JAXP API is a (supposedly) standard API defined in Java 5. Saxon implements this interface.
Details of Saxon's implementation are described at <a class="bodylink" href="../xpath-api/jaxp-xpath.xml">The JAXP XPath API</a>.
Note that there are some extensions and other variations in the Saxon implementation.
Some of the extensions to this interface are provided because Saxon supports XPath 2.0,
whereas JAXP 1.3 is designed primarily for XPath 1.0; some are provided because Saxon supports multiple object models,
not only DOM; some are for backwards compatibility;
and some are provided to allow applications a finer level of control if required.</p>
         </li>
         <li content="para">
            <p>The preferred interface for XPath processing is the s9api interface, which also supports
XSLT and XQuery processing, schema validation, and other Saxon functionality in an integrated set
of interfaces. This is described at <a class="bodylink" href="../xpath-api/s9api-xpath.xml">Evaluating XPath Expressions using s9api</a>
         </p>
         </li>
         <li content="para">
            <p>For historical reasons Saxon continues to support a legacy XPath API in package <code>net.sf.saxon.sxpath</code>.
This is documented only in the Javadoc specifications. It is a lower-level API, so as well as being retained
for backwards compatibility, it may also be appropriate for applications that require a very intimate level of
integration with Saxon internals.</p>
         </li>
      </ul>
      <table width="100%">
         <tr>
            <td>
               <p align="right"><a class="nav" href="s9api-xpath.xml">Next</a></p>
            </td>
         </tr>
      </table>
   </body>
</html>