JAXP Factory Interfaces
Saxon implements a number of JAXP interfaces, notably the APIs for transformation, XPath processing, and validation.
For transformation, the root object of the API is the JAXP
TransformerFactory
. Saxon provides three implementations of this
interface: net.sf.saxon.TransformerFactoryImpl
for Saxon-HE, and com.saxonica.config.ProfessionalTransformerFactory
and com.saxonica.config.EnterpriseTransformerFactory
for Saxon-PE and Saxon-EE
respectively. This interface provides methods getAttribute(name)
and
setAttribute(name, value)
which correspond directly to the methods
getConfigurationProperty(name)
and setConfigurationProperty(name,
value)
on the underlying Configuration
object. By casting from the JAXP interface to the Saxon
implementation class it is also possible to call the getConfiguration
method which exposes the Configuration
object directly.
The Saxon-PE and Saxon-EE implementations of the TransformerFactory
also
allow the configuration property FeatureKeys.CONFIGURATION_FILE to be set.
The value is a filename containing the name of a configuration file, which must have the
format described in Configuration file. This causes any previously-initialized configuration to be
discarded, and replaced with a new Configuration
object built from the
settings in the specified configuration file.
The JAXP XPathFactory
interface has a general-purpose configuration
mechanism in the form of the two methods setFeature()
and
getFeature()
. These can be used to set/get all boolean-valued
configuration options in the underlying Saxon Configuration
, 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 Configuration
object and use
its native interfaces. Saxon's implementation class for the XPathFactory
is
net.sf.saxon.xpath.XPathFactoryImpl
, regardless which Saxon edition is in
use.
Saxon-EE also implements the JAXP SchemaFactory
in class com.saxonica.ee.jaxp.SchemaFactoryImpl
. The interface offers methods
getProperty(name)
and setProperty(name, value)
which map to
the underlying methods in the Saxon Configuration
; again, it is also
possible to cast to the Saxon implementation class and call configuration-setting
methods directly.