net.sf.saxon.s9api
public class Processor extends Object
Processor
class serves three purposes: it allows global Saxon configuration options to be set;
it acts as a factory for generating XQuery, XPath, and XSLT compilers; and it owns certain shared
resources such as the Saxon NamePool and compiled schemas. This is the first object that a
Saxon application should create. Once established, a Processor may be used in multiple threads.
It is possible to run more than one Saxon Processor concurrently, but only when running completely independent workloads. Nothing can be shared between Processor instances. Within a query or transformation, all source documents and schemas must be built using the same Processor, which must also be used to compile the query or stylesheet.
Constructor Summary | |
---|---|
Processor(boolean licensedEdition)
Create a Processor | |
Processor(Source source)
Create a Processor configured according to the settings in a supplied configuration file. |
Method Summary | |
---|---|
Object | getConfigurationProperty(String name)
Get the value of a configuration property |
String | getSaxonProductVersion()
Get the user-visible Saxon product version, for example "9.0.0.1" |
SchemaManager | getSchemaManager()
Get the associated SchemaManager. |
Configuration | getUnderlyingConfiguration()
Get the underlying Configuration object that underpins this Processor. |
String | getXmlVersion()
Get the version of XML used by this Processor. |
boolean | isSchemaAware()
Test whether this processor is schema-aware |
DocumentBuilder | newDocumentBuilder()
Create a DocumentBuilder. |
XPathCompiler | newXPathCompiler()
Create an XPathCompiler. |
XQueryCompiler | newXQueryCompiler()
Create an XQueryCompiler. |
XsltCompiler | newXsltCompiler()
Create an XsltCompiler. |
void | registerExtensionFunction(ExtensionFunctionDefinition function)
Register an extension function that is to be made available within any stylesheet, query,
or XPath expression compiled under the control of this processor. |
void | setConfigurationProperty(String name, Object value)
Set a configuration property |
void | setXmlVersion(String version)
Set the version of XML used by this Processor. |
void | writeXdmValue(XdmValue value, Destination destination)
Write an XdmValue to a given destination. |
Parameters: licensedEdition indicates whether the Processor requires features of Saxon that need a license file (that is, features not available in Saxon HE (Home Edition). If true, the method will look for a valid license file and instantiate a Configuration appropriate to the features that have been licensed, that is, a ProfessionalConfiguration or EnterpriseConfiguration. If no suitable license is found, the method falls back to creating an HE configuration (which is also the effect if the argument is set to false.)
Parameters: source the Source of the configuration file
Throws: SaxonApiException if the configuration file cannot be read, or its contents are invalid
Since: 9.2
Parameters: name the name of the option required. The names of the properties available are listed as constants in class FeatureKeys.
Returns: the value of the property, if one is set; or null if the property is unset and there is no default.
Throws: IllegalArgumentException if the property name is not recognized
Returns: the Saxon product version, as a string
Returns: the associated SchemaManager, or null if the Processor is not schema-aware.
Returns: the underlying Configuration object
Returns: one of the strings "1.0" or "1.1"
Returns: true if this is a schema-aware processor, false otherwise
Returns: a newly created DocumentBuilder
Returns: a newly created XPathCompiler
Returns: a newly created XQueryCompiler
Throws: UnsupportedOperationException if this version of the Saxon product does not support XQuery processing
Returns: a newly created XsltCompiler
Throws: UnsupportedOperationException if this version of the Saxon product does not support XSLT processing
Parameters: function the class that implements the extension function. This must be a class that extends ExtensionFunctionCall, and it must have a public zero-argument constructor
Throws: IllegalArgumentException if the class cannot be instantiated or does not extend ExtensionFunctionCall
Since: 9.2
Parameters: name the name of the option to be set. The names of the options available are listed as constants in class FeatureKeys. value the value of the option to be set.
Throws: IllegalArgumentException if the property name is not recognized
Note that source documents specifying xml version="1.0" or "1.1" are accepted regardless of this setting.
Parameters: version must be one of the strings "1.0" or "1.1"
Throws: IllegalArgumentException if any string other than "1.0" or "1.1" is supplied
Parameters: value the value to be written destination the destination to which the value is to be written