<?xml version="1.0" encoding="iso-8859-1"?> <?xml-stylesheet href="../../make-menu.xsl" type="text/xsl"?><html> <head> <this-is section="configuration" page="config-interfaces" subpage="jaxp-configuration"/> <!-- Generated at 2011-12-09T20:47:22.916Z--><title>Saxonica: XSLT and XQuery Processing: JAXP Factory Interfaces</title> <meta name="coverage" content="Worldwide"/> <meta name="copyright" content="Copyright Saxonica Ltd"/> <meta name="title" content="Saxonica: XSLT and XQuery Processing: JAXP Factory Interfaces"/> <meta name="robots" content="noindex,nofollow"/> <link rel="stylesheet" href="../../saxondocs.css" type="text/css"/> </head> <body class="main"> <h1>JAXP Factory Interfaces</h1> <p>Saxon implements a number of JAXP interfaces, notably the APIs for transformation, XPath processing, and validation.</p> <p>For transformation, the root object of the API is the JAXP <code>TransformerFactory</code>. Saxon provides three implementations of this interface: <a class="bodylink" href="../../javadoc/net/sf/saxon/TransformerFactoryImpl.html"><code>net.sf.saxon.TransformerFactoryImpl</code></a> for Saxon-HE, and <a class="bodylink" href="../../javadoc/com/saxonica/config/ProfessionalTransformerFactory.html"><code>com.saxonica.config.ProfessionalTransformerFactory</code></a> and <a class="bodylink" href="../../javadoc/com/saxonica/config/EnterpriseTransformerFactory.html"><code>com.saxonica.config.EnterpriseTransformerFactory</code></a> for Saxon-PE and Saxon-EE respectively. This interface provides methods <code>getAttribute(name)</code> and <code>setAttribute(name, value)</code> which correspond directly to the methods <code>getConfigurationProperty(name)</code> and <code>setConfigurationProperty(name, value)</code> on the underlying <a class="bodylink" href="../../javadoc/net/sf/saxon/Configuration.html"><code>Configuration</code></a> object. By casting from the JAXP interface to the Saxon implementation class it is also possible to call the <code>getConfiguration</code> method which exposes the <code>Configuration</code> object directly.</p> <p>The Saxon-PE and Saxon-EE implementations of the <code>TransformerFactory</code> also allow the configuration property <a class="bodylink" href="../../javadoc/net/sf/saxon/lib/FeatureKeys.html#CONFIGURATION_FILE"><code>FeatureKeys.CONFIGURATION_FILE</code></a> to be set. The value is a filename containing the name of a configuration file, which must have the format described in <a class="bodylink" href="../../configuration/configuration-file.xml">Configuration file</a>. This causes any previously-initialized configuration to be discarded, and replaced with a new <code>Configuration</code> object built from the settings in the specified configuration file.</p> <p>The JAXP <code>XPathFactory</code> interface has a general-purpose configuration mechanism in the form of the two methods <code>setFeature()</code> and <code>getFeature()</code>. These can be used to set/get all boolean-valued configuration options in the underlying Saxon <code>Configuration</code>, as well as the options defined in the JAXP interface itself. To set configuration options that are not boolean-valued, it is necessary to navigate to the underlying <code>Configuration</code> object and use its native interfaces. Saxon's implementation class for the <code>XPathFactory</code> is <a class="bodylink" href="../../javadoc/net/sf/saxon/xpath/XPathFactoryImpl.html"><code>net.sf.saxon.xpath.XPathFactoryImpl</code></a>, regardless which Saxon edition is in use.</p> <div class="boxed" style="border: solid thin; background-color: #B1CCC7; padding: 2px">Note that although Saxon implements the JAXP XPath API, it is rarely possible to use it in a way that has no dependencies on the Saxon implementation, partly because of the requirement for all Saxon tasks to run under the same <code>Configuration</code>. When using the XPath API, therefore, the <code>Configuration</code> object is usually exposed to the application.</div> <p>Saxon-EE also implements the JAXP <code>SchemaFactory</code> in class <a class="bodylink" href="../../javadoc/com/saxonica/jaxp/SchemaFactoryImpl.html"><code>com.saxonica.jaxp.SchemaFactoryImpl</code></a>. The interface offers methods <code>getProperty(name)</code> and <code>setProperty(name, value)</code> which map to the underlying methods in the Saxon <code>Configuration</code>; again, it is also possible to cast to the Saxon implementation class and call configuration-setting methods directly.</p> <table width="100%"> <tr> <td> <p align="right"><a class="nav" href="s9api-config.xml">Next</a></p> </td> </tr> </table> </body> </html>