net.sf.saxon.s9api
Class Processor
java.lang.Object
net.sf.saxon.s9api.Processor
public class Processor
extends java.lang.Object
The
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.
Processor(boolean schemaAware) - Create a Processor
|
Processor
public Processor(boolean schemaAware)
Create a Processor
schemaAware
- indicates whether the Processor is schema-aware or not. To create a schema-aware
processor, the Saxon-SA product is required.
getConfigurationProperty
public Object getConfigurationProperty(String name)
Get a configuration option
name
- the name of the option required. The names of the options available are listed
as constants in class FeatureKeys
- the value of the option to be set. The type of the value depends on the option
that is being set
getSaxonProductVersion
public String getSaxonProductVersion()
Get the user-visible Saxon product version, for example "9.0.0.1"
- the Saxon product version, as a string
getSchemaManager
public SchemaManager getSchemaManager()
Get the associated SchemaManager. The SchemaManager provides capabilities to load and cache
XML schema definitions. There is exactly one SchemaManager in a schema-aware Processor, and none
in a Processor that is not schema-aware. The SchemaManager is created automatically by the system.
- the associated SchemaManager, or null if the Processor is not schema-aware.
getUnderlyingConfiguration
public Configuration getUnderlyingConfiguration()
Get the underlying
Configuration
object that underpins this Processor. This method
provides an escape hatch to internal Saxon implementation objects that offer a finer and lower-level
degree of control than the s9api classes and methods. Some of these classes and methods may change
from release to release.
- the underlying Configuration object
getXmlVersion
public String getXmlVersion()
Get the version of XML used by this Processor. If the value is "1.0", then input documents
must be XML 1.0 documents, and output documents will be serialized as XML 1.0. This option also affects
the characters permitted to appear in queries and stylesheets, and the characters that can appear
in names (for example, in path expressions).
- one of the strings "1.0" or "1.1"
isSchemaAware
public boolean isSchemaAware()
Test whether this processor is schema-aware
- true if this is a schema-aware processor, false otherwise
newDocumentBuilder
public DocumentBuilder newDocumentBuilder()
Create a DocumentBuilder. A DocumentBuilder is used to load source XML documents.
- a newly created DocumentBuilder
newXPathCompiler
public XPathCompiler newXPathCompiler()
Create an XPathCompiler. An XPathCompiler is used to compile XPath expressions.
- a newly created XPathCompiler
newXQueryCompiler
public XQueryCompiler newXQueryCompiler()
Create an XQueryCompiler. An XQueryCompiler is used to compile XQuery queries.
- a newly created XQueryCompiler
newXsltCompiler
public XsltCompiler newXsltCompiler()
Create an XsltCompiler. An XsltCompiler is used to compile XSLT stylesheets.
- a newly created XsltCompiler
setConfigurationProperty
public void setConfigurationProperty(String name,
Object value)
Set a configuration option
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. The type of the value depends on the option
that is being set
setXmlVersion
public void setXmlVersion(String version)
Set the version of XML used by this Processor. If the value is set to "1.0", then
output documents will be serialized as XML 1.0. This option also affects
the characters permitted to appear in queries and stylesheets, and the characters that can appear
in names (for example, in path expressions).
Note that source documents specifying xml version="1.0" or "1.1" are accepted
regardless of this setting.
version
- must be one of the strings "1.0" or "1.1"