public class Configuration extends java.lang.Object implements SourceResolver, NotationSet
As well as holding configuration settings, this class acts as a factory for classes providing service in particular areas: error handling, URI resolution, and the like. Some of these services are chosen on the basis of the current platform (Java or .NET), some vary depending whether the environment is schema-aware or not.
The Configuration
provides access to a NamePool
which is used to manage
all the names used in stylesheets, queries, schemas, and source and documents: the NamePool
allocates integer codes to these names allowing efficient storage and comparison. Normally
there will be a one-to-one relationship between a NamePool
and a Configuration
.
It is possible, however, for several Configuration
objects to share the same
NamePool
. Until Saxon 8.9, by default all Configuration
objects
shared a single NamePool
unless configured otherwise; this changed in 8.9 so that
the default is to allocate a new NamePool
for each Configuration
.
The Configuration
establishes the scope within which node identity is managed.
Every document belongs to a Configuration
, and every node has a distinct identity
within that Configuration
. In consequence, it is not possible for any query or
transformation to manipulate multiple documents unless they all belong to the same
Configuration
.
Saxon-EE has a subclass of the Configuration
class which provides the additional
services needed for schema-aware processing. The EnterpriseConfiguration
also holds a cache of loaded schema components used for compiling schema-aware transformations
and queries, and for validating instance documents.
Since Saxon 8.4, the JavaDoc documentation for Saxon attempts to identify interfaces that are considered stable, and will only be changed in a backwards-incompatible way if there is an overriding reason to do so. These interfaces and methods are labelled with the JavaDoc "since" tag. The value 8.n indicates a method in this category that was introduced in Saxon version 8.n: or in the case of 8.4, that was present in Saxon 8.4 and possibly in earlier releases. (In some cases, these methods have been unchanged for a long time.) Methods without a "since" tag, although public, are provided for internal use or for use by advanced users, and are subject to change from one release to the next. The presence of a "since" tag on a class or interface indicates that there are one or more methods in the class that are considered stable; it does not mean that all methods are stable.
Modifier and Type | Class and Description |
---|---|
static interface |
Configuration.ApiProvider
Marker interface to represent an API that is provided as a layer on top of this
Configuration |
static class |
Configuration.LicenseFeature
This class contains constants representing features of the software that may or may
not be licensed.
|
Modifier and Type | Field and Description |
---|---|
protected static java.util.Set<Feature> |
booleanFeatures |
protected FunctionLibraryList |
builtInExtensionLibraryList |
protected int |
byteCodeThreshold |
protected CollectionFinder |
collectionFinder |
protected StaticQueryContext |
defaultStaticQueryContext |
protected CompilerInfo |
defaultXsltCompilerInfo |
static int |
DO_NOT_RECOVER
Constant indicating that when a recoverable error occurs, the
processor should not attempt to take the defined recovery action,
but should terminate with an error.
|
static int |
JAVA_APPLICATION
Constant indicating that the host language is Java: that is, this is a free-standing
Java application with no XSLT or XQuery content
|
protected Optimizer |
optimizer |
protected OptimizerOptions |
optimizerOptions |
static int |
RECOVER_SILENTLY
Constant indicating that the processor should take the recovery action
when a recoverable error occurs, with no warning message.
|
static int |
RECOVER_WITH_WARNINGS
Constant indicating that the processor should produce a warning
when a recoverable error occurs, and should then take the recovery
action and continue.
|
protected TypeHierarchy |
typeHierarchy |
static int |
XML_SCHEMA
Constant indicating that the "host language" is XML Schema
|
static int |
XML10
Constant indicating the XML Version 1.0
|
static int |
XML11
Constant indicating the XML Version 1.1
|
static int |
XPATH
Constant indicating that the host language is XPATH itself - that is, a free-standing XPath environment
|
static int |
XQUERY
Constant indicating that the host language is XQuery
|
static int |
XSD10
Language versions for XML Schema
|
static int |
XSD11 |
protected int |
xsdVersion |
static int |
XSLT
Constant indicating that the host language is XSLT
|
Constructor and Description |
---|
Configuration()
Create a non-schema-aware configuration object with default settings for all options.
|
Modifier and Type | Method and Description |
---|---|
void |
addExtensionBinders(FunctionLibraryList list)
Add the registered extension binders to a function library.
|
void |
addSchemaForBuiltInNamespace(java.lang.String namespace)
Add a built-in schema for a given namespace.
|
void |
addSchemaSource(javax.xml.transform.Source schemaSource)
Load a schema, which will be available for use by all subsequent operations using
this Configuration.
|
void |
addSchemaSource(javax.xml.transform.Source schemaSource,
javax.xml.transform.ErrorListener errorListener)
Load a schema, which will be available for use by all subsequent operations using
this EnterpriseConfiguration.
|
DocumentInfo |
buildDocument(javax.xml.transform.Source source)
Deprecated.
since 9.7: use
buildDocumentTree(Source) . |
DocumentInfo |
buildDocument(javax.xml.transform.Source source,
ParseOptions parseOptions)
Deprecated.
since 9.7: use
buildDocumentTree(Source, ParseOptions) . |
TreeInfo |
buildDocumentTree(javax.xml.transform.Source source)
Build a document tree, using options set on this Configuration and on the supplied source
object.
|
TreeInfo |
buildDocumentTree(javax.xml.transform.Source source,
ParseOptions parseOptions)
Build a document, using specified options for parsing and building.
|
void |
checkLicensedFeature(int feature,
java.lang.String name,
int localLicenseId)
Check whether a particular feature is licensed, with a fatal error if it is not
|
void |
checkStrictStreamability(XSLTemplate template,
Expression body)
Check the streamability of a template rule
|
void |
checkTypeDerivationIsOK(SchemaType derived,
SchemaType base,
int block)
Check that a type is validly derived from another type, following the rules for the Schema Component
Constraint "Is Type Derivation OK (Simple)" (3.14.6) or "Is Type Derivation OK (Complex)" (3.4.6) as
appropriate.
|
void |
clearSchemaCache()
Remove all schema components that have been loaded into this Configuration.
|
void |
close()
Close any resources held by the Configuration.
|
RegularExpression |
compileRegularExpression(java.lang.CharSequence regex,
java.lang.String flags,
java.lang.String hostLanguage,
java.util.List<java.lang.String> warnings)
Compile a regular expression (or, in some configurations, get a compiled
regular expression from a cache
|
void |
createByteCodeReport(java.lang.String fileName)
Generate a report on byte code instrumentation to a specified file
|
InvalidityReportGenerator |
createValidityReporter() |
org.xml.sax.XMLReader |
createXMLParser()
Get an XML parser for source documents.
|
void |
disableLicensing()
Instruct Saxon to run as if no license is available.
|
void |
displayLicenseMessage()
Display a message about the license status
|
void |
exportComponents(Receiver out)
Export a precompiled Schema Component Model containing all the components (except built-in components)
that have been loaded into this Processor.
|
MapItem |
externalObjectAsMap(ObjectValue value,
java.lang.String required)
Convert a Java object to a map
|
Receiver |
getAnnotationStripper(Receiver destination)
Add to a pipeline a receiver that strips all type annotations.
|
SchemaDeclaration |
getAttributeDeclaration(int fingerprint)
Get a global attribute declaration by fingerprint
|
SchemaDeclaration |
getAttributeDeclaration(StructuredQName attributeName)
Get a global attribute declaration by name
|
boolean |
getBooleanProperty(Feature feature)
Get a boolean property of the configuration
|
FunctionLibraryList |
getBuiltInExtensionLibraryList() |
CharacterSetFactory |
getCharacterSetFactory()
Get the CharacterSetFactory.
|
java.lang.Class |
getClass(java.lang.String className,
boolean tracing,
java.lang.ClassLoader classLoader)
Load a class using the class name provided.
|
StringCollator |
getCollation(java.lang.String collationName)
Get the collation with a given collation name.
|
StringCollator |
getCollation(java.lang.String collationURI,
java.lang.String baseURI)
Get the collation with a given collation name, supplying a relative URI and base
URI separately.
|
StringCollator |
getCollation(java.lang.String collationURI,
java.lang.String baseURI,
java.lang.String errorCode)
Get the collation with a given collation name, supplying a relative URI and base
URI separately, and throwing an error if it cannot be found.
|
CollationURIResolver |
getCollationURIResolver()
Get the collation URI resolver associated with this configuration.
|
CollectionFinder |
getCollectionFinder()
Get the collection finder associated with this configuration.
|
CollectionURIResolver |
getCollectionURIResolver()
Deprecated.
since 9.7. Use
getCollectionFinder() |
static Configuration |
getConfiguration(XPathContext context)
Get the configuration, given the context.
|
<T> T |
getConfigurationProperty(Feature<T> feature)
Get a property of the configuration
|
java.lang.Object |
getConfigurationProperty(java.lang.String name)
Get a property of the configuration
|
XPathContext |
getConversionContext()
Get an XPathContext object with sufficient capability to perform comparisons and conversions
|
ConversionRules |
getConversionRules()
Get the conversion rules used to convert between atomic types.
|
int |
getCountDown() |
Debugger |
getDebugger()
Get the debugger in use.
|
java.util.Collection<GlobalParam> |
getDeclaredSchemaParameters()
Get the set of saxon:param schema parameters declared in the schema held by this Configuration.
|
java.lang.String |
getDefaultCollationName()
Get the name of the global default collation
|
java.lang.String |
getDefaultCollection()
Get the URI of the default collection.
|
ContextItemStaticInfo |
getDefaultContextItemStaticInfo()
Get a default ContextItemStaticInfo, indication no information is available about the context item
type
|
java.lang.String |
getDefaultCountry()
Get the default country to be used for number and date formatting when no country is specified.
|
java.lang.String |
getDefaultLanguage()
Get the default language.
|
java.lang.String |
getDefaultRegexEngine()
Get the default regular expression to be used
|
java.util.Properties |
getDefaultSerializationProperties()
Get the default output properties.
|
StaticQueryContext |
getDefaultStaticQueryContext()
Get the default options for XQuery compilation
|
CompilerInfo |
getDefaultXsltCompilerInfo()
Get the default options for XSLT compilation
|
DocumentNumberAllocator |
getDocumentNumberAllocator()
Get the document number allocator.
|
Receiver |
getDocumentValidator(Receiver receiver,
java.lang.String systemId,
ParseOptions validationOptions,
Location initiatingLocation)
Get a document-level validator to add to a Receiver pipeline.
|
DynamicLoader |
getDynamicLoader()
Get the DynamicLoader used by this Configuration.
|
java.lang.String |
getEditionCode()
Get the edition code identifying this configuration: "HE", "PE" or "EE"
|
SchemaDeclaration |
getElementDeclaration(int fingerprint)
Get a global element declaration by fingerprint
|
SchemaDeclaration |
getElementDeclaration(StructuredQName qName)
Get a global element declaration by name.
|
Receiver |
getElementValidator(Receiver receiver,
ParseOptions validationOptions,
Location locationId)
Get a Receiver that can be used to validate an element, and that passes the validated
element on to a target receiver.
|
UnfailingErrorListener |
getErrorListener()
Get the ErrorListener used in this configuration.
|
java.util.Iterator<? extends SchemaType> |
getExtensionsOfType(SchemaType type)
Get the set of complex types that have been defined as extensions of a given type.
|
ExternalObjectModel |
getExternalObjectModel(java.lang.Class nodeClass)
Get the external object model that recognizes a particular class of node, if available
|
ExternalObjectModel |
getExternalObjectModel(java.lang.String uri)
Get the external object model with a given URI, if registered
|
java.util.List<ExternalObjectModel> |
getExternalObjectModels()
Get all the registered external object models.
|
java.util.function.Function<SequenceIterator<?>,FocusTrackingIterator<?>> |
getFocusTrackerFactory(Executable exec,
boolean multithreaded)
Get a factory function that can be used to wrap a SequenceIterator in a FocusTrackingIterator.
|
FunctionAnnotationHandler |
getFunctionAnnotationHandler(java.lang.String namespace)
Get the FunctionAnnotationHandler used to handle XQuery function annotations
in a particular namespace
|
DocumentPool |
getGlobalDocumentPool()
Get the global document pool.
|
java.util.Set<java.lang.String> |
getImportedNamespaces()
Get the set of namespaces of imported schemas
|
java.lang.Object |
getInstance(java.lang.String className,
java.lang.ClassLoader classLoader)
Instantiate a class using the class name provided.
|
IntegratedFunctionLibrary |
getIntegratedFunctionLibrary()
Get the IntegratedFunction library containing integrated extension functions
|
JavaExternalObjectType |
getJavaExternalObjectType(java.lang.Class theClass)
Get the JavaExternalObjectType object representing a particular Java class
|
java.lang.String |
getLabel()
Get the associated label for this configuration
|
java.lang.String |
getLicenseFeature(java.lang.String name)
Get the value of a named license feature
|
LocalizerFactory |
getLocalizerFactory()
Get the localizer factory in use
|
Logger |
getLogger() |
java.util.Comparator<java.lang.String> |
getMediaQueryEvaluator()
Get a comparator which can be used to assess whether the media pseudo-attribute
in an xml-stylesheet processing instruction matches the media requested in the API
for the transformation
|
java.lang.String |
getMediaTypeForFileExtension(java.lang.String extension)
Get the media type to be associated with a file extension by the standard
collection handler
|
java.lang.String |
getMessageEmitterClass()
Get the name of the class that will be instantiated to create a MessageEmitter,
to process the output of xsl:message instructions in XSLT.
|
ModuleURIResolver |
getModuleURIResolver()
Get the user-defined ModuleURIResolver for resolving URIs used in "import module"
declarations in the XQuery prolog; returns null if none has been explicitly set.
|
<F extends Item<?>,T extends Item<?>> |
getMultithreadedItemMappingIterator(SequenceIterator<F> base,
ItemMappingFunction<F,T> action)
Get an item mapping iterator suitable for multi-threaded execution, if this is permitted
|
NamePool |
getNamePool()
Get the target namepool to be used for stylesheets/queries and for source documents.
|
OptimizerOptions |
getOptimizerOptions()
Get the optimization options in use
|
OutputURIResolver |
getOutputURIResolver()
Get the OutputURIResolver that will be used to resolve URIs used in the
href attribute of the xsl:result-document instruction.
|
ParseOptions |
getParseOptions()
Get the parsing and document building options defined in this configuration
|
Configuration.ApiProvider |
getProcessor()
Get the Processor object that created this Configuration in the relevant API.
|
java.lang.String |
getProductTitle()
Get a message used to identify this product when a transformation is run using the -t option
|
int |
getRecoveryPolicy()
Determine how recoverable run-time errors are to be handled.
|
ResourceFactory |
getResourceFactoryForMediaType(java.lang.String mediaType)
Get the resource factory associated with a media type
|
Function |
getSchemaAsFunctionItem()
Get information about the schema in the form of a function item.
|
Function |
getSchemaComponentAsFunctionItem(java.lang.String kind,
QNameValue name)
Get information about the schema in the form of a function item.
|
SchemaType |
getSchemaType(StructuredQName name)
Get the top-level schema type definition with a given QName.
|
int |
getSchemaValidationMode()
Ask whether source documents (supplied as a StreamSource or SAXSource)
should be subjected to schema validation, and if so, in what validation mode
|
SerializerFactory |
getSerializerFactory()
Get the SerializerFactory.
|
org.xml.sax.XMLReader |
getSourceParser()
Get a parser for source documents.
|
java.lang.String |
getSourceParserClass()
Get the name of the class that will be instantiated to create an XML parser
for parsing source documents (for example, documents loaded using the document()
or doc() functions).
|
SourceResolver |
getSourceResolver()
Get the current SourceResolver.
|
java.io.PrintStream |
getStandardErrorOutput()
Get the standard error output to be used in all cases where no more specific destination
is defined.
|
ModuleURIResolver |
getStandardModuleURIResolver()
Get the standard system-defined ModuleURIResolver for resolving URIs used in "import module"
declarations in the XQuery prolog.
|
int |
getStreamability()
Get the streamability rules to be applied.
|
org.xml.sax.XMLReader |
getStyleParser()
Get the parser for stylesheet documents.
|
java.lang.String |
getStyleParserClass()
Get the name of the class that will be instantiated to create an XML parser
for parsing stylesheet modules.
|
Function |
getSystemFunction(StructuredQName name,
int arity)
Get a system function.
|
StandardURIResolver |
getSystemURIResolver()
Get the system-defined URI Resolver.
|
TraceListener |
getTraceListener()
Get the TraceListener used for run-time tracing of instruction execution.
|
java.lang.String |
getTraceListenerClass()
Get the name of the trace listener class to be used for run-time tracing of instruction
execution.
|
java.lang.String |
getTraceListenerOutputFile()
Get the name of the file to be used for TraceListener output.
|
int |
getTreeModel()
Get the Tree Model used by this Configuration.
|
TreeStatistics |
getTreeStatistics()
Get the collection of tree-builder statistics for this configuration, used
for learning suitable amounts of space to allocate for different kinds of tree
|
TypeChecker |
getTypeChecker(boolean backwardsCompatible)
Get an appropriate type-checker.
|
TypeHierarchy |
getTypeHierarchy()
Get the TypeHierarchy: a cache holding type information
|
UnparsedTextURIResolver |
getUnparsedTextURIResolver()
Get the URI resolver used for resolving URIs passed to the unparsed-text(),
unparsed-text-available(), and unparsed-text-lines() functions
|
javax.xml.transform.URIResolver |
getURIResolver()
Get the URIResolver used in this configuration
|
BuiltInFunctionSet |
getUseWhenFunctionSet() |
java.util.function.IntPredicate |
getValidCharacterChecker()
Get an IntPredicate that tests whether a given character is valid in the selected
version of XML
|
int |
getXMLVersion()
Get the XML version to be used by default for validating characters and names
|
BuiltInFunctionSet |
getXPath30FunctionSet() |
BuiltInFunctionSet |
getXPath31FunctionSet() |
BuiltInFunctionSet |
getXQueryUpdateFunctionSet() |
int |
getXsdVersion()
Get the version of XML Schema to be used
|
BuiltInFunctionSet |
getXSLT30FunctionSet() |
void |
importComponents(javax.xml.transform.Source source)
Import a precompiled Schema Component Model from a given Source.
|
void |
importLicenseDetails(Configuration config) |
protected void |
init() |
protected java.lang.Object |
instantiateClassName(java.lang.String propertyName,
java.lang.Object value,
java.lang.Class<?> requiredClass) |
static Configuration |
instantiateConfiguration(java.lang.String className,
java.lang.ClassLoader classLoader)
Instantiate a Configuration object with a given class name
|
protected void |
internalSetBooleanProperty(Feature property,
java.lang.Object value)
Set a boolean property value, without checking that it is a recognized property name
|
static boolean |
isAssertionsEnabled()
Ask if Java is being run with assertions enabled (-ea option)
|
boolean |
isCompatible(Configuration other)
Determine whether two Configurations are compatible.
|
boolean |
isCompileWithTracing()
Determine whether compile-time generation of trace code was requested
|
boolean |
isDeclaredNotation(java.lang.String uri,
java.lang.String local)
Ask whether a given notation has been declared in the schema
|
boolean |
isDeferredByteCode(int hostLanguage)
Ask whether bytecode should be generated in Just-In-time compilation and therefore deferring the byte code generation.
|
boolean |
isExpandAttributeDefaults()
Determine whether elements and attributes that have a fixed or default value are to be expanded.
|
boolean |
isExtensionElementAvailable(StructuredQName qName)
Ask whether an extension element with a particular name is available
|
boolean |
isFeatureAllowedBySecondaryLicense(int localLicenseId,
int feature)
Ask whether a particular feature is enabled by an embedded license (embedded in a SEF file)
|
boolean |
isGenerateByteCode(int hostLanguage)
Ask whether bytecode should be generated.
|
boolean |
isJITEnabled()
Ask whether just-in-time compilation of XSLT template rules is in force
|
boolean |
isLicensedFeature(int feature)
Determine if a particular feature is licensed.
|
boolean |
isLineNumbering()
Determine whether source documents will maintain line numbers, for the
benefit of the saxon:line-number() extension function as well as run-time
tracing.
|
boolean |
isSchemaAvailable(java.lang.String targetNamespace)
Determine whether the Configuration contains a cached schema for a given target namespace
|
boolean |
isStreamedNode(NodeInfo node)
Ask whether a given node is a streamed node
|
boolean |
isStripsAllWhiteSpace()
Determine whether whitespace-only text nodes are to be stripped unconditionally
from source documents.
|
boolean |
isTiming()
Determine whether brief progress messages and timing information will be output.
|
boolean |
isValidation()
Determine whether the XML parser for source documents will be asked to perform
validation of source documents
|
boolean |
isValidationWarnings()
Determine whether schema validation failures on result documents are to be treated
as fatal errors or as warnings.
|
boolean |
isVersionWarning()
Determine whether a warning is to be output when running against a stylesheet labelled
as version="1.0".
|
boolean |
isXIncludeAware()
Test whether or not source documents (including stylesheets and schemas) are to have
XInclude processing applied to them, or not
|
void |
loadSchema(java.lang.String absoluteURI)
Simple interface to load a schema document
|
static java.io.InputStream |
locateResource(java.lang.String filename,
java.util.List<java.lang.String> messages,
java.util.List<java.lang.ClassLoader> loaders)
Read a resource file issued with the Saxon product
|
static javax.xml.transform.stream.StreamSource |
locateResourceSource(java.lang.String filename,
java.util.List<java.lang.String> messages,
java.util.List<java.lang.ClassLoader> loaders)
Read a resource file issued with the Saxon product, returning a StreamSource with bound systemId
This means it can be an XSLT stylesheet which uses inclusions etc.
|
AccumulatorRegistry |
makeAccumulatorRegistry()
Factory method to make the AccumulatorRegistry, used for static information
about the accumulators defined in a package
|
Sequence<?> |
makeClosure(Expression expression,
int ref,
XPathContext context)
Make a Closure, given the expected reference count
|
CompilerInfo |
makeCompilerInfo()
Make an XSLT CompilerInfo object - can be overridden in a subclass to produce variants
capable of optimization
|
ICompilerService |
makeCompilerService(int hostLanguage)
Make a CompilerService object, to handle byte code generation, or null if byte code
generation is not available
|
protected ConfigurationReader |
makeConfigurationReader() |
ContextItemStaticInfo |
makeContextItemStaticInfo(ItemType itemType,
boolean maybeUndefined)
Factory method to make a ContextItemStaticInfo
|
FilterFactory |
makeDocumentProjector(PathMap.PathMapRoot map)
Create a document projector for a given path map root.
|
FilterFactory |
makeDocumentProjector(XQueryExpression exp)
Create a document projector for the document supplied as the initial context item
in a query.
|
Receiver |
makeEmitter(java.lang.String clarkName,
java.util.Properties props)
Load a named output emitter or SAX2 ContentHandler and check it is OK.
|
Expression |
makeEvaluateInstruction(XSLEvaluate source,
ComponentDeclaration decl)
Make an instruction to implement xsl:evaluate
|
Expression |
makeFunctionSequenceCoercer(SpecificFunctionType type,
Expression exp,
RoleDiagnostic role)
Generate a function sequence coercer, that is, an expression which converts a sequence of function
items to a sequence of function items satisfying a given required type; the coerced functions call the
original function with arguments converted as necessary, or fail if conversion is not possible
|
static Configuration |
makeLicensedConfiguration(java.lang.ClassLoader classLoader,
java.lang.String className)
Static method to instantiate a professional or enterprise configuration.
|
java.util.Map<java.lang.String,Function> |
makeMethodMap(java.lang.Class javaClass,
java.lang.String required)
Make a map representing the methods defined in a class.
|
SimpleMode |
makeMode(StructuredQName modeName,
CompilerInfo compilerInfo)
Make a new Mode - this can be overridden in subclasses to produce optimized variants
|
Numberer |
makeNumberer(java.lang.String language,
java.lang.String country)
Load a Numberer class for a given language and check it is OK.
|
Expression |
makeObjectLookupExpression(Expression lhs,
Expression rhs) |
IPackageLoader |
makePackageLoader() |
org.xml.sax.XMLReader |
makeParser(java.lang.String className)
Create a new SAX XMLReader object using the class name provided.
|
PipelineConfiguration |
makePipelineConfiguration()
Make a PipelineConfiguration from the properties of this Configuration
|
SchemaURIResolver |
makeSchemaURIResolver(javax.xml.transform.URIResolver resolver) |
GroundedValue<?> |
makeSequenceExtent(Expression expression,
int ref,
XPathContext context)
Make a SequenceExtent, given the expected reference count
|
SlotManager |
makeSlotManager()
Factory method to create a SlotManager.
|
protected StaticQueryContext |
makeStaticQueryContext(boolean copyFromDefault)
Make a new static query context object using the factory registered with this configuration
|
Receiver |
makeStreamingTransformer(XPathContext context,
Mode mode,
ParameterSet ordinaryParams,
ParameterSet tunnelParams)
Create a streaming transformer
|
Expression |
makeStreamInstruction(Expression hrefExp,
Expression body,
boolean streaming,
ParseOptions options,
PackageData packageData,
Location location,
RetainedStaticContext rsc) |
StyleNodeFactory |
makeStyleNodeFactory(Compilation compilation)
Factory method to make the StyleNodeFactory, used for constructing elements
in a stylesheet document
|
StylesheetPackage |
makeStylesheetPackage()
Factory method to make a StylesheetPackage
|
SystemFunction |
makeSystemFunction(java.lang.String localName,
int arity)
Make a function in the "fn" namespace
|
TemplateRule |
makeTemplateRule()
Factory method to create a Template Rule
|
XPathContextMajor.ThreadManager |
makeThreadManager()
Make a ThreadManager for asynchronous xsl:result-document instructions
|
TraceListener |
makeTraceListener()
Get or create the TraceListener used for run-time tracing of instruction execution.
|
TraceListener |
makeTraceListener(java.lang.String className)
Create an instance of a TraceListener with a specified class name
|
TypeAliasManager |
makeTypeAliasManager()
Make a TypeAliasManager appropriate to the type of Configuration
|
javax.xml.transform.URIResolver |
makeURIResolver(java.lang.String className)
Create an instance of a URIResolver with a specified class name.
|
ItemType |
makeUserUnionType(java.util.List<AtomicType> memberTypes)
Make a union type with a given list of member types
|
XQueryExpression |
makeXQueryExpression(Expression exp,
QueryModule mainModule,
boolean streaming)
Factory method to make an XQueryExpression
|
protected void |
needEnterpriseEdition()
Throw an error indicating that a request cannot be satisfied because it requires
the schema-aware edition of Saxon
|
static Configuration |
newConfiguration()
Factory method to create a Configuration, of the class defined using conditional
compilation tags when compiling this version of Saxon: that is,
the type of Configuration appropriate to the edition of the software
being used.
|
ExpressionPresenter |
newExpressionExporter(java.lang.String target,
java.io.OutputStream destination,
StylesheetPackage rootPackage)
Get a new ExpressionPresenter capable of exporting a compiled stylesheet
|
XPathParser |
newExpressionParser(java.lang.String language,
boolean updating,
int languageVersion)
Make an expression Parser for a specified version of XPath or XQuery
|
PendingUpdateList |
newPendingUpdateList()
Get a new Pending Update List
|
StaticQueryContext |
newStaticQueryContext()
Get a new StaticQueryContext (which is also the factory class for creating a query parser).
|
UserFunction |
newUserFunction(boolean memoFunction,
FunctionStreamability streamability)
Make a UserFunction object.
|
SerializationProperties |
obtainDefaultSerializationProperties()
Obtain a default
SerializationProperties object. |
Optimizer |
obtainOptimizer()
Factory method to get an Optimizer.
|
Optimizer |
obtainOptimizer(OptimizerOptions options)
Factory method to get an Optimizer with specified optimizer options.
|
void |
prepareValidationReporting(XPathContext context,
ParseOptions options)
Set validation reporting options.
|
void |
processResultDocument(ResultDocument instruction,
Expression content,
XPathContext context)
Process an xsl:result-document instruction.
|
static Configuration |
readConfiguration(javax.xml.transform.Source source)
Factory method to construct a Configuration object by reading a configuration file.
|
static Configuration |
readConfiguration(javax.xml.transform.Source source,
Configuration baseConfiguration)
Factory method to construct a Configuration object by reading a configuration file.
|
protected Configuration |
readConfigurationFile(javax.xml.transform.Source source)
Read the configuration file an construct a new Configuration (the real one)
|
protected Configuration |
readConfigurationFile(javax.xml.transform.Source source,
Configuration baseConfiguration) |
java.lang.String |
readInlineSchema(NodeInfo root,
java.lang.String expected,
javax.xml.transform.ErrorListener errorListener)
Read an inline schema from a stylesheet.
|
void |
readMultipleSchemas(PipelineConfiguration pipe,
java.lang.String baseURI,
java.util.Collection<java.lang.String> schemaLocations,
java.lang.String expected)
Read schemas from a list of schema locations.
|
java.lang.String |
readSchema(PipelineConfiguration pipe,
java.lang.String baseURI,
java.lang.String schemaLocation,
java.lang.String expected)
Read a schema from a given schema location
|
void |
registerCollation(java.lang.String collationURI,
StringCollator collator)
Register a collation.
|
void |
registerCollection(java.lang.String collectionURI,
ResourceCollection collection)
Register a specific URI and bind it to a specific ResourceCollection.
|
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 |
registerExternalObjectModel(ExternalObjectModel model)
Register an external object model with this Configuration.
|
void |
registerFileExtension(java.lang.String extension,
java.lang.String mediaType)
Set the media type to be associated with a file extension by the standard
collection handler
|
void |
registerFunctionAnnotationHandler(FunctionAnnotationHandler handler)
Register a FunctionAnnotationHandler to handle XQuery function annotations
in a particular namespace
|
int |
registerLocalLicense(java.lang.String dmk)
Register a local license file (for use within a single transformation (etc))
|
void |
registerMediaType(java.lang.String contentType,
ResourceFactory factory)
Associate a media type with a resource factory.
|
void |
reportFatalError(XPathException err)
Report a fatal error
|
static boolean |
requireBoolean(java.lang.String propertyName,
java.lang.Object value)
Validate a property value where the required type is boolean
|
protected int |
requireInteger(java.lang.String propertyName,
java.lang.Object value)
Validate a property value where the required type is integer
|
protected java.lang.String |
requireString(java.lang.String propertyName,
java.lang.Object value) |
javax.xml.transform.Source |
resolveSource(javax.xml.transform.Source source,
Configuration config)
Resolve a Source.
|
void |
reuseSourceParser(org.xml.sax.XMLReader parser)
Return a source parser to the pool, for reuse
|
void |
reuseStyleParser(org.xml.sax.XMLReader parser)
Return a stylesheet (or schema) parser to the pool, for reuse
|
void |
sealNamespace(java.lang.String namespace)
Mark a schema namespace as being sealed.
|
void |
setBooleanProperty(Feature<java.lang.Boolean> feature,
boolean value)
Set a boolean property of the configuration
|
void |
setBooleanProperty(java.lang.String propertyName,
boolean value)
Set a boolean property of the configuration
|
void |
setCollationURIResolver(CollationURIResolver resolver)
Set a CollationURIResolver to be used to resolve collation URIs (that is,
to take a URI identifying a collation, and return the corresponding collation).
|
void |
setCollectionFinder(CollectionFinder cf)
Set the collection finder associated with this configuration.
|
void |
setCollectionURIResolver(CollectionURIResolver resolver)
Deprecated.
since 9.7. Use
setCollectionFinder(CollectionFinder) |
void |
setCompileWithTracing(boolean trace)
Request compile-time generation of trace code (or not)
|
<T> void |
setConfigurationProperty(Feature<T> feature,
T value)
Set a property of the configuration.
|
void |
setConfigurationProperty(java.lang.String name,
java.lang.Object value)
Set a property of the configuration.
|
void |
setConversionRules(ConversionRules rules)
Set the conversion rules to be used to convert between atomic types.
|
void |
setDebugger(Debugger debugger)
Set the debugger to be used.
|
void |
setDefaultCollection(java.lang.String uri)
Set the default collection.
|
void |
setDefaultCountry(java.lang.String country)
Set the default country to be used for number and date formatting when no country is specified.
|
void |
setDefaultLanguage(java.lang.String language)
Set the default language to be used for number and date formatting when no language is specified.
|
void |
setDefaultRegexEngine(java.lang.String engine)
Set the default regular expression engine to be used
|
void |
setDefaultSerializationProperties(java.util.Properties props)
Set the default serialization properties.
|
void |
setDocumentNumberAllocator(DocumentNumberAllocator allocator)
Set the document number allocator.
|
void |
setDynamicLoader(DynamicLoader dynamicLoader)
Set the DynamicLoader to be used.
|
void |
setErrorListener(javax.xml.transform.ErrorListener listener)
Set the ErrorListener to be used in this configuration.
|
void |
setExpandAttributeDefaults(boolean expand)
Indicate whether attributes that have a fixed or default value are to be expanded when
generating a final result tree.
|
void |
setLabel(java.lang.String label)
Set a label for this configuration
|
void |
setLineNumbering(boolean lineNumbering)
Determine whether source documents will maintain line numbers, for the
benefit of the saxon:line-number() extension function as well as run-time
tracing.
|
void |
setLocalizerFactory(LocalizerFactory factory)
Set the localizer factory to be used
|
void |
setLogger(Logger logger)
Register a new logger to be used in the Saxon event logging mechanism
|
void |
setMediaQueryEvaluator(java.util.Comparator<java.lang.String> comparator)
Set a comparator which can be used to assess whether the media pseudo-attribute
in an xml-stylesheet processing instruction matches the media requested in the API
for the transformation
|
void |
setMessageEmitterClass(java.lang.String messageReceiverClassName)
Set the name of the class that will be instantiated to
to process the output of xsl:message instructions in XSLT.
|
void |
setModuleURIResolver(ModuleURIResolver resolver)
Set a user-defined ModuleURIResolver for resolving URIs used in "import module"
declarations in an XQuery prolog.
|
void |
setModuleURIResolver(java.lang.String className)
Create and register an instance of a ModuleURIResolver with a specified class name.
|
void |
setNamePool(NamePool targetNamePool)
Set the NamePool to be used for stylesheets/queries and for source documents.
|
void |
setOutputURIResolver(OutputURIResolver outputURIResolver)
Deprecated.
since 9.9. Use
AbstractXsltTransformer.setResultDocumentHandler(java.util.function.Function)
or XsltController.setResultDocumentResolver(ResultDocumentResolver) instead. |
void |
setParameterizedURIResolver()
Set the URIResolver to a URI resolver that allows query parameters after the URI,
and in the case of Saxon-EE, that inteprets the file extension .ptree
|
void |
setProcessor(Configuration.ApiProvider processor)
Save the ApiProvider object that owns this
Configuration in the relevant API. |
void |
setRecoveryPolicy(int recoveryPolicy)
Determine how recoverable run-time errors are to be handled.
|
void |
setSchemaValidationMode(int validationMode)
Say whether source documents (supplied as a StreamSource or SAXSource)
should be subjected to schema validation, and if so, in what validation mode.
|
void |
setSerializerFactory(SerializerFactory factory)
Set a custom SerializerFactory.
|
void |
setSourceParserClass(java.lang.String sourceParserClass)
Set the name of the class that will be instantiated to create an XML parser
for parsing source documents (for example, documents loaded using the document()
or doc() functions).
|
void |
setSourceResolver(SourceResolver resolver)
Supply a SourceResolver.
|
void |
setStandardErrorOutput(java.io.PrintStream out)
Set the standard error output to be used in all cases where no more specific destination
is defined.
|
void |
setStaticQueryContextFactory(StaticQueryContextFactory factory)
Set the StaticQueryContextFactory used for creating instances of StaticQueryContext
|
void |
setStripsAllWhiteSpace(boolean stripsAllWhiteSpace)
Deprecated.
since 9.8: use getParseOptions().setSpaceStrippingRule(AllElementsSpaceStrippingRule.getInstance())
|
void |
setStyleParserClass(java.lang.String parser)
Set the name of the class that will be instantiated to create an XML parser
for parsing stylesheet modules.
|
void |
setTiming(boolean timing)
Determine whether brief progress messages and timing information will be output.
|
void |
setTraceListener(TraceListener traceListener)
Set the TraceListener to be used for run-time tracing of instruction execution.
|
void |
setTraceListenerClass(java.lang.String className)
Set the name of the trace listener class to be used for run-time tracing of instruction
execution.
|
void |
setTraceListenerOutputFile(java.lang.String filename)
Set the name of the file to be used for TraceListener output.
|
void |
setTreeModel(int treeModel)
Set the Tree Model used by this Configuration.
|
void |
setUnparsedTextURIResolver(UnparsedTextURIResolver resolver)
Set the URI resolver to be used for resolving URIs passed to the unparsed-text(),
unparsed-text-available(), and unparsed-text-lines() functions
|
void |
setURIResolver(javax.xml.transform.URIResolver resolver)
Set the URIResolver to be used in this configuration.
|
void |
setValidation(boolean validation)
Determine whether the XML parser for source documents will be asked to perform
DTD validation of source documents
|
void |
setValidationWarnings(boolean warn)
Indicate whether schema validation failures on result documents are to be treated
as fatal errors or as warnings.
|
void |
setVersionWarning(boolean warn)
Determine whether a warning is to be output when the version attribute of the stylesheet does
not match the XSLT processor version.
|
void |
setXIncludeAware(boolean state)
Set whether or not source documents (including stylesheets and schemas) are have
XInclude processing applied to them, or not.
|
void |
setXMLVersion(int version)
Set the XML version to be used by default for validating characters and names.
|
NodeInfo |
unravel(javax.xml.transform.Source source)
Get a NodeInfo corresponding to a DOM or other external Node,
either by wrapping or unwrapping the external Node.
|
SimpleType |
validateAttribute(StructuredQName nodeName,
java.lang.CharSequence value,
int validation)
Validate an attribute value.
|
protected static java.util.Set<Feature> booleanFeatures
protected CollectionFinder collectionFinder
protected transient StaticQueryContext defaultStaticQueryContext
protected OptimizerOptions optimizerOptions
protected CompilerInfo defaultXsltCompilerInfo
protected Optimizer optimizer
protected transient TypeHierarchy typeHierarchy
protected FunctionLibraryList builtInExtensionLibraryList
protected int xsdVersion
protected int byteCodeThreshold
public static final int RECOVER_SILENTLY
public static final int RECOVER_WITH_WARNINGS
public static final int DO_NOT_RECOVER
public static final int XML10
public static final int XML11
public static final int XSLT
public static final int XQUERY
public static final int XML_SCHEMA
public static final int JAVA_APPLICATION
public static final int XPATH
public static final int XSD10
public static final int XSD11
public Configuration()
public static Configuration newConfiguration()
public static java.io.InputStream locateResource(java.lang.String filename, java.util.List<java.lang.String> messages, java.util.List<java.lang.ClassLoader> loaders)
filename
- the filename of the file to be readmessages
- List to be populated with messages in the event of failureloaders
- List to be populated with the ClassLoader that succeeded in loading the resourcepublic static javax.xml.transform.stream.StreamSource locateResourceSource(java.lang.String filename, java.util.List<java.lang.String> messages, java.util.List<java.lang.ClassLoader> loaders)
filename
- the filename of the file to be readmessages
- List to be populated with messages in the event of failureloaders
- List to be populated with the ClassLoader that succeeded in loading the resourcepublic static Configuration readConfiguration(javax.xml.transform.Source source) throws XPathException
source
- Source object containing the configuration fileXPathException
- if the configuration file cannot be read
or is invalidpublic static Configuration readConfiguration(javax.xml.transform.Source source, Configuration baseConfiguration) throws XPathException
source
- Source object containing the configuration filebaseConfiguration
- an existing configuration whose NamePool and DocumentNumberAllocator
will be used in the new ConfigurationXPathException
- if the configuration file cannot be read
or is invalidpublic static Configuration instantiateConfiguration(java.lang.String className, java.lang.ClassLoader classLoader) throws java.lang.ClassNotFoundException, java.lang.InstantiationException, java.lang.IllegalAccessException
className
- the class nameclassLoader
- the class loader to be usedjava.lang.ClassNotFoundException
- if the class is not foundjava.lang.InstantiationException
- if the class cannot be instantiatedjava.lang.IllegalAccessException
- if the class is not accessiblepublic static boolean isAssertionsEnabled()
protected Configuration readConfigurationFile(javax.xml.transform.Source source) throws XPathException
source
- the source of the configuration fileXPathException
- if the configuration file cannot be read or is invalidprotected Configuration readConfigurationFile(javax.xml.transform.Source source, Configuration baseConfiguration) throws XPathException
XPathException
protected ConfigurationReader makeConfigurationReader()
protected void init()
public static Configuration makeLicensedConfiguration(java.lang.ClassLoader classLoader, java.lang.String className) throws java.lang.RuntimeException
This method fails if the specified configuration class cannot be loaded, but it does not check whether there is a license available.
classLoader
- - the class loader to be used. If null, the context class loader for the current
thread is used.className
- - the name of the configuration class. Defaults to
"com.saxonica.config.ProfessionalConfiguration" if null is supplied. This allows an assembly
qualified name to be supplied under .NET. The class, once instantiated, must be an instance
of Configuration.java.lang.RuntimeException
- if the required Saxon edition cannot be loadedpublic void importLicenseDetails(Configuration config)
public java.lang.String getEditionCode()
public void setProcessor(Configuration.ApiProvider processor)
Configuration
in the relevant API.
Note: it is possible to use multiple APIs over the same Configuration
. This mechanism
is only capable of holding one of these, and is therefore only really useful in cases where
the API in use is homogeneous.
processor
- This can be any ApiProvider, but it is typically one of the
following:
net.sf.saxon.s9api.Processor
Saxon.Api.Processor
TransformerFactory
XPathFactory
SchemaFactory
XQDataSource
Configuration.ApiProvider
rather than any Object.public Configuration.ApiProvider getProcessor()
The main purpose of this interface is to allow extension functions called from a stylesheet or query to get access to the originating processor. This is particularly useful when methods are static as there is then limited scope for passing data from the calling application to the code of the extension function.
setProcessor(ApiProvider)
method, or null
if this method has not been called. In practice this property is used to hold one of the
following:
net.sf.saxon.s9api.Processor
Saxon.Api.Processor
TransformerFactory
XPathFactory
SchemaFactory
XQDataSource
Configuration.ApiProvider
rather than any Object.public java.lang.String getProductTitle()
public void checkLicensedFeature(int feature, java.lang.String name, int localLicenseId) throws LicenseException
feature
- the feature in question, identified by a constant in class Configuration.LicenseFeature
name
- the name of the feature for use in diagnosticslocalLicenseId
- identifies an embedded license, or -1 if not applicableLicenseException
- if the feature is not licensed. This is a RunTimeException, so it will normally be fatal.public void disableLicensing()
public boolean isFeatureAllowedBySecondaryLicense(int localLicenseId, int feature)
localLicenseId
- the identifier of the embedded licensefeature
- the feature in question, identified by a constant in class Configuration.LicenseFeature
public boolean isLicensedFeature(int feature)
feature
- the feature in question, identified by a constant in class Configuration.LicenseFeature
public java.lang.String getLicenseFeature(java.lang.String name)
name
- the name of the featurepublic void displayLicenseMessage()
public int registerLocalLicense(java.lang.String dmk)
dmk
- the license in encoded formpublic void setDynamicLoader(DynamicLoader dynamicLoader)
DynamicLoader
is used
for all dynamic loading of Java classes. This method allows the actions of the standard
DynamicLoader to be overriddendynamicLoader
- the DynamicLoader to be used by this Configurationpublic DynamicLoader getDynamicLoader()
public java.lang.Class getClass(java.lang.String className, boolean tracing, java.lang.ClassLoader classLoader) throws XPathException
This method is intended for internal use only. The call is delegated to the
DynamicLoader
, which may be overridden by a user-defined DynamicLoader
.
className
- A string containing the name of the
class, for example "com.microstar.sax.LarkDriver"tracing
- true if diagnostic tracing is requiredclassLoader
- The ClassLoader to be used to load the class, or null to
use the ClassLoader selected by the DynamicLoader.XPathException
- if the class cannot be loaded.public java.lang.Object getInstance(java.lang.String className, java.lang.ClassLoader classLoader) throws XPathException
This method is intended for internal use only. The call is delegated to the
DynamicLoader
, which may be overridden by a user-defined DynamicLoader
.
Diagnostic output is produced if the option "isTiming" is set (corresponding to the -t option on the command line).
className
- A string containing the name of the
class, for example "com.microstar.sax.LarkDriver"classLoader
- The ClassLoader to be used to load the class, or null to
use the ClassLoader selected by the DynamicLoader.XPathException
- if the class cannot be loaded.public javax.xml.transform.URIResolver getURIResolver()
public void setURIResolver(javax.xml.transform.URIResolver resolver)
resolver
- The URIResolver to be used.public void setParameterizedURIResolver()
public StandardURIResolver getSystemURIResolver()
public javax.xml.transform.URIResolver makeURIResolver(java.lang.String className) throws javax.xml.transform.TransformerException
className
- The fully-qualified name of the URIResolver classjavax.xml.transform.TransformerException
- if the requested class does not
implement the javax.xml.transform.URIResolver interfacepublic UnfailingErrorListener getErrorListener()
setErrorListener(ErrorListener)
method; if that was not an UnfailingErrorListener
,
it will have been wrapped in a DelegatingErrorListener
, and it is the DelegatingErrorListener
that this method returns.public void setErrorListener(javax.xml.transform.ErrorListener listener)
listener
- the ErrorListener to be usedpublic Logger getLogger()
public void reportFatalError(XPathException err)
err
- the exception to be reportedpublic void setStandardErrorOutput(java.io.PrintStream out)
out
- the stream to be used for error output where no more specific destination
has been supplied. The caller is responsible for closing this stream after use
(if necessary).public void setLogger(Logger logger)
logger
- the Logger to be used as default. The caller is responsible for
ensuring that this is closed after use (if necessary), which can
be achieved by calling either Logger.close()
or
close()
;public java.io.PrintStream getStandardErrorOutput()
public void setXMLVersion(int version)
version
- one of the constants XML10 or XML11public int getXMLVersion()
public ParseOptions getParseOptions()
public void setMediaQueryEvaluator(java.util.Comparator<java.lang.String> comparator)
comparator
- a comparator which returns 0 (equals) when the first argument of the compare
method is the value of the media attribute in the xml-stylesheet processing
instruction, and the second argument is the value of the required media given
in the calling API. The default implementation always returns 0, indicating that
the media pseudo-attribute is ignored. An alternative implementation, consistent
with previous Saxon releases, would be compare the strings for equality. A fully
conformant implementation could implement the syntax and semantics of media queries
as defined in CSS 3.public java.util.Comparator<java.lang.String> getMediaQueryEvaluator()
public void setConversionRules(ConversionRules rules)
rules
- the conversion rules to be usedpublic ConversionRules getConversionRules()
public int getXsdVersion()
public XPathContext getConversionContext()
public java.util.function.IntPredicate getValidCharacterChecker()
public int getTreeModel()
Builder.LINKED_TREE
, Builder.TINY_TREE
, or Builder.TINY_TREE_CONDENSED
.
The default is Builder.TINY_TREE
.public void setTreeModel(int treeModel)
Builder.LINKED_TREE
or Builder.TINY_TREE
, or Builder.TINY_TREE_CONDENSED
.
The default is Builder.TINY_TREE
.treeModel
- the integer constant representing the selected Tree Modelpublic boolean isLineNumbering()
public void setLineNumbering(boolean lineNumbering)
lineNumbering
- true if line numbers are maintained in source documentspublic void setXIncludeAware(boolean state)
state
- true if XInclude elements are to be expanded, false if notpublic boolean isXIncludeAware()
public TraceListener getTraceListener()
setTraceListener(net.sf.saxon.lib.TraceListener)
if set.
Otherwise, returns null.public TraceListener makeTraceListener() throws XPathException
setTraceListener(net.sf.saxon.lib.TraceListener)
,
returns that TraceListener. Otherwise, if a TraceListener class has been set using
setTraceListenerClass(String)
, returns a newly created instance of that class.
Otherwise, returns null.XPathException
- if the supplied TraceListenerClass cannot be instantiated as an instance
of TraceListenerpublic void setTraceListener(TraceListener traceListener)
Note: this method should not be used if the Configuration is multithreading. In that situation,
use setCompileWithTracing(boolean)
to force stylesheets and queries to be compiled
with trace code enabled, and use Controller.addTraceListener(net.sf.saxon.lib.TraceListener)
to
supply a TraceListener at run time.
traceListener
- The TraceListener to be used. If null is supplied, any existing TraceListener is removedpublic void setTraceListenerClass(java.lang.String className)
TraceListener
.className
- the name of the trace listener class. If null, any existing trace listener is
removed from the configuration.java.lang.IllegalArgumentException
- if the class cannot be instantiated or does not implement
TraceListenerpublic java.lang.String getTraceListenerClass()
TraceListener
.public void setTraceListenerOutputFile(java.lang.String filename)
filename
- the filename for TraceListener outputpublic java.lang.String getTraceListenerOutputFile()
public boolean isCompileWithTracing()
public void setCompileWithTracing(boolean trace)
trace
- true if compile-time generation of trace code is requiredpublic TraceListener makeTraceListener(java.lang.String className) throws XPathException
className
- The fully qualified class name of the TraceListener to
be constructedXPathException
- if the requested class does not
implement the net.sf.saxon.trace.TraceListener interfacepublic BuiltInFunctionSet getXSLT30FunctionSet()
public BuiltInFunctionSet getUseWhenFunctionSet()
public BuiltInFunctionSet getXPath30FunctionSet()
public BuiltInFunctionSet getXPath31FunctionSet()
public BuiltInFunctionSet getXQueryUpdateFunctionSet()
public SystemFunction makeSystemFunction(java.lang.String localName, int arity)
localName
- the local name of the functionarity
- the arity of the functionpublic void registerExtensionFunction(ExtensionFunctionDefinition function)
ExtensionFunctionDefinition
, using an arbitrary name and namespace.
This supplements the ability to call arbitrary Java methods using a namespace and local name
that are related to the Java class and method name.function
- the object that implements the extension function.public IntegratedFunctionLibrary getIntegratedFunctionLibrary()
public FunctionLibraryList getBuiltInExtensionLibraryList()
public void addExtensionBinders(FunctionLibraryList list)
list
- the function library listpublic Function getSystemFunction(StructuredQName name, int arity) throws XPathException
name
- the name of the required functionarity
- the arity of the required functionXPathException
- if dynamic function calls are not permitted by this Saxon Configurationpublic UserFunction newUserFunction(boolean memoFunction, FunctionStreamability streamability)
memoFunction
- true if the function is to be a memo function, This option is ignored
in Saxon-HE.streamability
- the declared streamability of the functionpublic void registerCollation(java.lang.String collationURI, StringCollator collator)
collationURI
- the URI of the collation. This should be an absolute URI,
though it is not checkedcollator
- the implementation of the collationpublic void setCollationURIResolver(CollationURIResolver resolver)
Note that it is undefined whether collation URIs are resolved at compile time or at run-time. It is therefore inadvisable to change the CollationURIResolver after compiling a query or stylesheet and before running it.
resolver
- the collation URI resolver to be used. This replaces any collation
URI resolver previously registered.public CollationURIResolver getCollationURIResolver()
setCollationURIResolver(net.sf.saxon.lib.CollationURIResolver)
method; if this has not been called, it returns the system-defined collation URI resolverpublic StringCollator getCollation(java.lang.String collationName) throws XPathException
collationName
- the collation name as an absolute URIXPathException
- if the collation URI is recognized but is invalid; for example,
if it is a URI that takes parameters, and the parameters are invalid. If a user-supplied
collation URI resolver is in use, then any exception thrown by that resolver is passed
on to the caller.public StringCollator getCollation(java.lang.String collationURI, java.lang.String baseURI) throws XPathException
collationURI
- the collation name as a relative or absolute URIbaseURI
- the base URI to be used to resolve the collationURI if it is relativeXPathException
- if a failure occurs during URI resolutionpublic StringCollator getCollation(java.lang.String collationURI, java.lang.String baseURI, java.lang.String errorCode) throws XPathException
collationURI
- the collation name as a relative or absolute URIbaseURI
- the base URI to be used to resolve the collationURI if it is relative;
may be null if the supplied collationURI is known to be absoluteerrorCode
- the error to raise if the collation is not knownXPathException
- if a failure occurs during URI resolutionpublic java.lang.String getDefaultCollationName()
public void setDefaultCollection(java.lang.String uri)
If no default collection URI is specified, then a request for the default collection is handled by calling the registered collection URI resolver with an argument of null.
uri
- the URI of the default collection. Calling the collection() function
with no arguments is equivalent to calling collection() with this URI as an argument.
The URI will be dereferenced by passing it to the registered CollectionURIResolver.
If null is supplied, any existing default collection is removed.public java.lang.String getDefaultCollection()
public void setCollectionURIResolver(CollectionURIResolver resolver)
setCollectionFinder(CollectionFinder)
Collection URIs are always resolved at run-time, using the CollectionURIResolver in force at the time the collection() function is called.
Calling this method has the effect of calling setCollectionFinder(CollectionFinder)
with a CollectionFinder
that wraps this CollectionURIResolver
.
resolver
- the collection URI resolver to be used. This replaces any collection
URI resolver previously registered. The value must not be null.public CollectionURIResolver getCollectionURIResolver()
getCollectionFinder()
setCollectionURIResolver(net.sf.saxon.lib.CollectionURIResolver)
method; if this has not been called, it returns the system-defined collection URI resolver
Calling this method has the effect of calling getCollectionFinder()
; if the result
is a CollectionFinder
that wraps a CollectionURIResolver
, then
the wrapped CollectionURIFinder is returned.
public void setCollectionFinder(CollectionFinder cf)
cf
- the CollectionFinder to be usedpublic CollectionFinder getCollectionFinder()
public void registerCollection(java.lang.String collectionURI, ResourceCollection collection)
CollectionFinder
in use is a StandardCollectionFinder
.collectionURI
- the collection URI to be registered. Must not be null.collection
- the ResourceCollection to be associated with this URI. Must not be null.java.lang.IllegalStateException
- if the CollectionFinder
in use is not a
StandardCollectionFinder
public void registerFileExtension(java.lang.String extension, java.lang.String mediaType)
extension
- the file extension, for example "xml". The value "" sets
the default media type to be used for unregistered file extensions.mediaType
- the corresponding media type, for example "application/xml". The
choice of media type determines how a resource with this extension
gets parsed, when the file appears as part of a collection.public void registerMediaType(java.lang.String contentType, ResourceFactory factory)
contentType
- a media type or MIME type, for example application/xsd+xmlfactory
- a ResourceFactory used to parse (or otherwise process) resources of that typepublic java.lang.String getMediaTypeForFileExtension(java.lang.String extension)
extension
- the file extension, for example "xml". The value "" gets
the default media type to be used for unregistered file extensions.
the default media type is also returned if the supplied file
extension is not registered.public ResourceFactory getResourceFactoryForMediaType(java.lang.String mediaType)
mediaType
- the media type or MIME type, for example "application/xml"public void setLocalizerFactory(LocalizerFactory factory)
factory
- the LocalizerFactorypublic LocalizerFactory getLocalizerFactory()
public void setDefaultLanguage(java.lang.String language)
language
- the default language to be used, as an ISO code for example "en" or "fr-CA"java.lang.IllegalArgumentException
- if not valid as an xs:language instance.public java.lang.String getDefaultLanguage()
public void setDefaultCountry(java.lang.String country)
country
- the default country to be used, as an ISO code for example "US" or "GB"public java.lang.String getDefaultCountry()
public void setDefaultRegexEngine(java.lang.String engine)
engine
- the default regular expression engine to be used. The value must be one of:
public java.lang.String getDefaultRegexEngine()
public RegularExpression compileRegularExpression(java.lang.CharSequence regex, java.lang.String flags, java.lang.String hostLanguage, java.util.List<java.lang.String> warnings) throws XPathException
regex
- the regular expression as a stringflags
- the value of the flags attributehostLanguage
- one of "XSD10", "XSD11", XP20" or "XP30". Also allow combinations, e.g. "XP20/XSD11".warnings
- if non-null, any warnings from the regular expression compiler will be added to this list.
If null, the warnings are ignored.XPathException
- if the regular expression or the flags are invalidpublic Numberer makeNumberer(java.lang.String language, java.lang.String country)
language
- the language for which a Numberer is required. May be null,
indicating default languagecountry
- the country for which a Numberer is required. May be null,
indicating default countrypublic void setModuleURIResolver(ModuleURIResolver resolver)
resolver
- the URI resolver for XQuery modules. May be null, in which case any existing
Module URI Resolver is removed from the configurationpublic void setModuleURIResolver(java.lang.String className) throws javax.xml.transform.TransformerException
className
- The fully-qualified name of the LocationHintResolver classjavax.xml.transform.TransformerException
- if the requested class does not
implement the net.sf.saxon.LocationHintResolver interfacepublic ModuleURIResolver getModuleURIResolver()
public ModuleURIResolver getStandardModuleURIResolver()
public UnparsedTextURIResolver getUnparsedTextURIResolver()
public void setUnparsedTextURIResolver(UnparsedTextURIResolver resolver)
resolver
- the URI resolver to be used for these functions.public CompilerInfo getDefaultXsltCompilerInfo()
public StaticQueryContext getDefaultStaticQueryContext()
protected StaticQueryContext makeStaticQueryContext(boolean copyFromDefault)
copyFromDefault
- true if the new static query context is to copy the properties
of the default static query context held in the configurationpublic void registerFunctionAnnotationHandler(FunctionAnnotationHandler handler)
handler
- a function annotation handler to be invoked in respect of function
annotations in the relevant namespacepublic FunctionAnnotationHandler getFunctionAnnotationHandler(java.lang.String namespace)
namespace
- the namespacepublic int getRecoveryPolicy()
RECOVER_SILENTLY
,
RECOVER_WITH_WARNINGS
, or DO_NOT_RECOVER
.public void setRecoveryPolicy(int recoveryPolicy)
recoveryPolicy
- the recovery policy to be used. The options are RECOVER_SILENTLY
,
RECOVER_WITH_WARNINGS
, or DO_NOT_RECOVER
.public int getStreamability()
public java.lang.String getMessageEmitterClass()
public void setMessageEmitterClass(java.lang.String messageReceiverClassName)
messageReceiverClassName
- the full class name of the message receiver. This
must implement net.sf.saxon.event.Receiver.public java.lang.String getSourceParserClass()
This method is retained in Saxon for backwards compatibility, but the preferred way of choosing an XML parser is to use JAXP interfaces, for example by supplying a JAXP SAXSource object initialized with an appropriate implementation of org.xml.sax.XMLReader.
public void setSourceParserClass(java.lang.String sourceParserClass)
This method is retained in Saxon for backwards compatibility, but the preferred way of choosing an XML parser is to use JAXP interfaces, for example by supplying a JAXP SAXSource object initialized with an appropriate implementation of org.xml.sax.XMLReader.
sourceParserClass
- the fully qualified name of the XML parser class. This must implement
the SAX2 XMLReader interface.public java.lang.String getStyleParserClass()
This method is retained in Saxon for backwards compatibility, but the preferred way of choosing an XML parser is to use JAXP interfaces, for example by supplying a JAXP Source object initialized with an appropriate implementation of org.xml.sax.XMLReader.
public void setStyleParserClass(java.lang.String parser)
This method is retained in Saxon for backwards compatibility, but the preferred way of choosing an XML parser is to use JAXP interfaces, for example by supplying a JAXP Source object initialized with an appropriate implementation of org.xml.sax.XMLReader.
parser
- the fully qualified name of the XML parser classpublic OutputURIResolver getOutputURIResolver()
public void setOutputURIResolver(OutputURIResolver outputURIResolver)
AbstractXsltTransformer.setResultDocumentHandler(java.util.function.Function)
or XsltController.setResultDocumentResolver(ResultDocumentResolver)
instead.outputURIResolver
- the OutputURIResolver to be used.public void setSerializerFactory(SerializerFactory factory)
factory
- a custom SerializerFactorypublic SerializerFactory getSerializerFactory()
public CharacterSetFactory getCharacterSetFactory()
public void setDefaultSerializationProperties(java.util.Properties props)
The method name is a misnomer, retained for backwards compatibility. A SerializationProperties
object contains a set of Properties
holding simple properties, together with an optional
CharacterMap
holding a character map. This method returns the simple properties only.
In fact the default properties held in the Configuration
only contain simple properties,
and never a character map.
props
- the default propertiespublic java.util.Properties getDefaultSerializationProperties()
Properties.setProperty(String, String)
to change the defaults
in force for the Configuration
.
The method name is a misnomer, retained for backwards compatibility. A SerializationProperties
object contains a set of Properties
holding simple properties, together with an optional
CharacterMap
holding a character map. This method returns the simple properties only.
In fact the default properties held in the Configuration
only contain simple properties,
and never a character map.
public SerializationProperties obtainDefaultSerializationProperties()
SerializationProperties
object.Configuration
within a SerializationProperties
wrapper.
The returned value can be modified in-situ using
methods such as SerializationProperties.setProperty(String, String)
to change the defaults
in force for the Configuration
.public void processResultDocument(ResultDocument instruction, Expression content, XPathContext context) throws XPathException
instruction
- the instruction to be executedcontent
- the expression that defines the content of the new result documentcontext
- the evaluation contextXPathException
- if any dynamic error occurspublic <F extends Item<?>,T extends Item<?>> SequenceIterator<T> getMultithreadedItemMappingIterator(SequenceIterator<F> base, ItemMappingFunction<F,T> action) throws XPathException
base
- iterator over the input sequenceaction
- mapping function to be applied to each item in the input sequence.XPathException
- if (for example) a dynamic error occurs while priming the queuepublic boolean isTiming()
This method is provided largely for internal use. Progress messages are normally controlled directly from the command line interfaces, and are not normally used when driving Saxon from the Java API.
public void setTiming(boolean timing)
This method is provided largely for internal use. Progress messages are normally controlled directly from the command line interfaces, and are not normally used when running from a Java application.
The name of the method is poorly chosen, since many of the progress messages that are output have little to do with timing or instrumentation.
If enabled, the relevant messages will be sent either to the destination set using
setLogger(Logger)
or to the destination set using setStandardErrorOutput(PrintStream)
,
depending on the message.
timing
- true if these messages are to be output.public boolean isVersionWarning()
public void setVersionWarning(boolean warn)
warn
- true if these warning messages are to be output.public boolean isValidation()
public void setValidation(boolean validation)
validation
- true if DTD validation is to be requested.public FilterFactory makeDocumentProjector(PathMap.PathMapRoot map)
map
- a path map root in a path map. This might represent the call to the initial
context item for a query, or it might represent a call on the doc() function. The path map
contains information about the paths that the query uses within this document.java.lang.UnsupportedOperationException
- if this is not a schema-aware configuration, or
if no Saxon-EE license is availablepublic FilterFactory makeDocumentProjector(XQueryExpression exp)
exp
- an XQuery expression. The document projector that is returned will
be for the document supplied as the context item to this query.java.lang.UnsupportedOperationException
- if this is not a schema-aware configuration, or
if no Saxon-EE license is availablepublic int getSchemaValidationMode()
Validation.STRIP
otherwise.public void setSchemaValidationMode(int validationMode)
validationMode
- the validation (or construction) mode to be used for source documents.
One of Validation.STRIP
, Validation.PRESERVE
, Validation.STRICT
,
Validation.LAX
public void setValidationWarnings(boolean warn)
warn
- true if schema validation failures are to be treated as warnings; false if they
are to be treated as fatal errors.public boolean isValidationWarnings()
public void setExpandAttributeDefaults(boolean expand)
This option can be overridden at the level of a PipelineConfiguration
expand
- true if fixed and default values are to be expanded as required by the W3C
specifications; false if this action is to be disabled. Note that this only affects the validation
of final result trees; it is not possible to suppress expansion of fixed or default values on input
documents, as this would make the type annotations on input nodes unsound.public boolean isExpandAttributeDefaults()
This option can be overridden at the level of a PipelineConfiguration
public NamePool getNamePool()
public void setNamePool(NamePool targetNamePool)
Using this method allows several Configurations to share the same NamePool. This was the normal default arrangement until Saxon 8.9, which changed the default so that each Configuration uses its own NamePool.
Sharing a NamePool creates a potential bottleneck, since changes to the namepool are synchronized.
targetNamePool
- The NamePool to be used.public TypeHierarchy getTypeHierarchy()
public TypeChecker getTypeChecker(boolean backwardsCompatible)
backwardsCompatible
- set to true if XPath 1.0 compatibility mode is requiredpublic TypeAliasManager makeTypeAliasManager()
public DocumentNumberAllocator getDocumentNumberAllocator()
The document number allocator is used to allocate a unique number to each document built under this
configuration. The document number forms the basis of all tests for node identity; it is therefore essential
that when two documents are accessed in the same XPath expression, they have distinct document numbers.
Normally this is ensured by building them under the same Configuration. Using this method together with
setDocumentNumberAllocator(net.sf.saxon.tree.util.DocumentNumberAllocator)
, however, it is possible to have two different Configurations that share
a single DocumentNumberAllocator
public void setDocumentNumberAllocator(DocumentNumberAllocator allocator)
The document number allocator is used to allocate a unique number to each document built under this
configuration. The document number forms the basis of all tests for node identity; it is therefore essential
that when two documents are accessed in the same XPath expression, they have distinct document numbers.
Normally this is ensured by building them under the same Configuration. Using this method together with
getDocumentNumberAllocator()
, however, it is possible to have two different Configurations that share
a single DocumentNumberAllocator
This method is for advanced applications only. Misuse of the method can cause problems with node identity. The method should not be used except while initializing a Configuration, and it should be used only to arrange for two different configurations to share the same DocumentNumberAllocators. In this case they should also share the same NamePool.
allocator
- the DocumentNumberAllocator to be usedpublic boolean isCompatible(Configuration other)
other
- the other Configuration to be compared with this onepublic DocumentPool getGlobalDocumentPool()
public boolean isStripsAllWhiteSpace()
public void setStripsAllWhiteSpace(boolean stripsAllWhiteSpace)
stripsAllWhiteSpace
- if all whitespace-only text nodes are to be stripped. Passing
the value false causes no change to the current settings.public org.xml.sax.XMLReader createXMLParser()
This method is intended primarily for internal use.
public org.xml.sax.XMLReader getSourceParser() throws javax.xml.transform.TransformerFactoryConfigurationError
This method is intended primarily for internal use.
setValidation(boolean)
setting.javax.xml.transform.TransformerFactoryConfigurationError
- if a failure occurs
configuring the parser for use.public void reuseSourceParser(org.xml.sax.XMLReader parser)
parser
- The parser: the caller must not supply a parser that was obtained by any
mechanism other than calling the getSourceParser() method.
Must not be null.public org.xml.sax.XMLReader getStyleParser() throws javax.xml.transform.TransformerFactoryConfigurationError
This method is intended for internal use only.
javax.xml.transform.TransformerFactoryConfigurationError
- if an error occurs
configuring the parserpublic void reuseStyleParser(org.xml.sax.XMLReader parser)
parser
- The parser: the caller must not supply a parser that was obtained by any
mechanism other than calling the getStyleParser() method.public void loadSchema(java.lang.String absoluteURI) throws SchemaException
absoluteURI
- the absolute URI of the location of the schema documentSchemaException
- if the schema document at the given location cannot be read or is invalidpublic java.lang.String readSchema(PipelineConfiguration pipe, java.lang.String baseURI, java.lang.String schemaLocation, java.lang.String expected) throws SchemaException
This method is intended for internal use.
pipe
- the PipelineConfigurationbaseURI
- the base URI of the instruction requesting the reading of the schemaschemaLocation
- the location of the schema to be readexpected
- The expected targetNamespace of the schema being read, or null if there is no expectationjava.lang.UnsupportedOperationException
- when called in the non-schema-aware version of the productSchemaException
- if the schema cannot be readpublic void readMultipleSchemas(PipelineConfiguration pipe, java.lang.String baseURI, java.util.Collection<java.lang.String> schemaLocations, java.lang.String expected) throws SchemaException
This method is intended for internal use.
pipe
- the pipeline configurationbaseURI
- the base URI against which the schema locations are to be resolvedschemaLocations
- the relative URIs specified as schema locationsexpected
- the namespace URI which is expected as the target namespace of the loaded schemaSchemaException
- if an error occurspublic java.lang.String readInlineSchema(NodeInfo root, java.lang.String expected, javax.xml.transform.ErrorListener errorListener) throws SchemaException
This method is intended for internal use.
root
- the xs:schema element in the stylesheetexpected
- the target namespace expected; null if there is no
expectation.errorListener
- The destination for error messages. May be null, in which case
the errorListener registered with this Configuration is used.SchemaException
- if the schema cannot be processedprotected void needEnterpriseEdition()
public void addSchemaSource(javax.xml.transform.Source schemaSource) throws SchemaException
schemaSource
- the JAXP Source object identifying the schema document to be loadedSchemaException
- if the schema cannot be read or parsed or if it is invalidjava.lang.UnsupportedOperationException
- if the configuration is not schema-awarepublic void addSchemaSource(javax.xml.transform.Source schemaSource, javax.xml.transform.ErrorListener errorListener) throws SchemaException
schemaSource
- the JAXP Source object identifying the schema document to be loadederrorListener
- the ErrorListener to be notified of any errors in the schema.SchemaException
- if the schema cannot be read or parsed or if it is invalidpublic void addSchemaForBuiltInNamespace(java.lang.String namespace)
namespace
- the namespace. Currently built-in schemas are available for the XML and FN namespacespublic boolean isSchemaAvailable(java.lang.String targetNamespace)
targetNamespace
- the target namespace of the schema being sought (supply "" for the
unnamed namespace)public void clearSchemaCache()
public java.util.Set<java.lang.String> getImportedNamespaces()
public void sealNamespace(java.lang.String namespace)
namespace
- the namespace URI of the components to be sealedpublic java.util.Collection<GlobalParam> getDeclaredSchemaParameters()
public java.util.Iterator<? extends SchemaType> getExtensionsOfType(SchemaType type)
type
- the type whose extensions are requiredpublic void importComponents(javax.xml.transform.Source source) throws XPathException
source
- the XML file containing the schema component model, as generated by a previous call on
exportComponents(net.sf.saxon.event.Receiver)
XPathException
- if an error occurspublic void exportComponents(Receiver out) throws XPathException
out
- the destination to recieve the precompiled Schema Component Model in the form of an
XML documentXPathException
- if a failure occurspublic Function getSchemaAsFunctionItem()
public Function getSchemaComponentAsFunctionItem(java.lang.String kind, QNameValue name) throws XPathException
kind
- the component kind, e.g. "element declaration"name
- the component nameXPathException
- if an error occurspublic SchemaDeclaration getElementDeclaration(int fingerprint)
fingerprint
- the NamePool fingerprint of the element namepublic SchemaDeclaration getElementDeclaration(StructuredQName qName)
qName
- the name of the required
element declarationpublic SchemaDeclaration getAttributeDeclaration(int fingerprint)
fingerprint
- the NamePool fingerprint of the element namepublic SchemaDeclaration getAttributeDeclaration(StructuredQName attributeName)
attributeName
- the name of the required attribute declarationpublic SchemaType getSchemaType(StructuredQName name)
name
- the name of the required schema typepublic ItemType makeUserUnionType(java.util.List<AtomicType> memberTypes)
memberTypes
- the member typespublic boolean isDeclaredNotation(java.lang.String uri, java.lang.String local)
isDeclaredNotation
in interface NotationSet
uri
- the targetNamespace of the notationlocal
- the local part of the notation namepublic void checkTypeDerivationIsOK(SchemaType derived, SchemaType base, int block) throws SchemaException
derived
- the derived typebase
- the base type; the algorithm tests whether derivation from this type is permittedblock
- the derivations that are blocked by the relevant element declarationSchemaException
- if the derivation is not allowedpublic void prepareValidationReporting(XPathContext context, ParseOptions options)
context
- the XPath evaluation contextoptions
- the parser options, to be updatedpublic Receiver getDocumentValidator(Receiver receiver, java.lang.String systemId, ParseOptions validationOptions, Location initiatingLocation)
This method is intended for internal use.
receiver
- The receiver to which events should be sent after validationsystemId
- the base URI of the document being validatedvalidationOptions
- Supplies options relevant to XSD validationinitiatingLocation
- The location of the expression that requested validationpublic Receiver getElementValidator(Receiver receiver, ParseOptions validationOptions, Location locationId) throws XPathException
This method is intended for internal use.
receiver
- the target receiver tp receive the validated elementvalidationOptions
- options affecting the way XSD validation is donelocationId
- current location in the stylesheet or queryXPathException
- if a validator for the element cannot be createdpublic SimpleType validateAttribute(StructuredQName nodeName, java.lang.CharSequence value, int validation) throws ValidationException, MissingComponentException
This method is intended for internal use.
nodeName
- the name of the attributevalue
- the value of the attribute as a stringvalidation
- STRICT or LAXValidationException
- if the value is invalidMissingComponentException
public Receiver getAnnotationStripper(Receiver destination)
This method is intended for internal use.
destination
- the Receiver that events will be written to after whitespace strippingpublic org.xml.sax.XMLReader makeParser(java.lang.String className) throws javax.xml.transform.TransformerFactoryConfigurationError
The named class must exist and must implement the org.xml.sax.XMLReader or Parser interface.
This method returns an instance of the parser named.
This method is intended for internal use.
className
- A string containing the name of the
SAX parser class, for example "com.microstar.sax.LarkDriver"javax.xml.transform.TransformerFactoryConfigurationError
- if a failure
occurs configuring the parser of this classpublic XPathParser newExpressionParser(java.lang.String language, boolean updating, int languageVersion) throws XPathException
language
- set to "XP" (XPath) or "XQ" (XQuery) or "PATTERN" (XSLT Patterns)updating
- indicates whether or not XQuery update syntax may be used. Note that XQuery Update
is supported only in Saxon-EElanguageVersion
- the required version (e.g 10 for "1.0", 30 for "3.0", 31 for "3.1").
A request for XQuery 1.0 or 3.0 delivers an XQuery 3.1 parser. The values
supported for XPath are 20 (=2.0), 30 (=3.0), 31 (=3.1), and 305 (=XPath 3.0
plus the syntax extensions defined in XSLT 3.0).XPathException
- if this version of Saxon does not support the
requested optionspublic ExpressionPresenter newExpressionExporter(java.lang.String target, java.io.OutputStream destination, StylesheetPackage rootPackage) throws XPathException
target
- the target environment, e.g. EE, JS, JS2destination
- the destination for the output filerootPackage
- the root package of the exportXPathException
- if none is available (e.g. because this is not Saxon-EE)public void setDebugger(Debugger debugger)
This method is provided for advanced users only, and is subject to change.
debugger
- the debugger to be used, or null if no debugger is to be usedpublic Debugger getDebugger()
This method is provided for advanced users only, and is subject to change.
public SlotManager makeSlotManager()
This method is provided for advanced users only, and is subject to change.
public Receiver makeStreamingTransformer(XPathContext context, Mode mode, ParameterSet ordinaryParams, ParameterSet tunnelParams) throws XPathException
context
- the initial XPath contextmode
- the initial mode, which must be a streaming modeordinaryParams
- the parameters that are not tunnel parameterstunnelParams
- the tunnel parametersXPathException
- if a streaming transformer cannot be created (which
is always the case in Saxon-HE and Saxon-PE)public Expression makeStreamInstruction(Expression hrefExp, Expression body, boolean streaming, ParseOptions options, PackageData packageData, Location location, RetainedStaticContext rsc) throws XPathException
XPathException
public java.util.function.Function<SequenceIterator<?>,FocusTrackingIterator<?>> getFocusTrackerFactory(Executable exec, boolean multithreaded)
Controller
to get a default factory function; the value can be overridden
by the application using Controller.setFocusTrackerFactory(java.util.function.Function)
.
The FocusTrackingIterator
that is created by the factory must be thread-safe if it is
to be used for iterating over a sequence where the items might be processed asynchronously using
xsl:result-document
; for this reason this method is overridden for a Saxon-EE configuration.exec
- the executable; supplied so that the factory can be sensitive to whether calls on xsl:result-document
are possiblemultithreaded
- set to true to get a factory suitable for creating focus tracking iterators for a
multi-threaded xsl:for-each instructionpublic void checkStrictStreamability(XSLTemplate template, Expression body) throws XPathException
XPathException
public boolean isStreamedNode(NodeInfo node)
node
- the node in questionpublic OptimizerOptions getOptimizerOptions()
public Optimizer obtainOptimizer()
This method is intended for internal use only.
public Optimizer obtainOptimizer(OptimizerOptions options)
This method is intended for internal use only.
options
- the optimizer optionspublic Expression makeFunctionSequenceCoercer(SpecificFunctionType type, Expression exp, RoleDiagnostic role) throws XPathException
type
- the required function typeexp
- the expression that delivers a sequence of function itemsrole
- diagnostic informationXPathException
- if conversion is not possiblepublic ContextItemStaticInfo makeContextItemStaticInfo(ItemType itemType, boolean maybeUndefined)
itemType
- the item type of the context item. If the context item is absent, set this to
ErrorType.getInstance()
.maybeUndefined
- set to true if it is possible (or certain) that the context item will be absent.public ContextItemStaticInfo getDefaultContextItemStaticInfo()
public XQueryExpression makeXQueryExpression(Expression exp, QueryModule mainModule, boolean streaming) throws XPathException
exp
- the expression forming the body of the querymainModule
- the query module containing the expressionstreaming
- true if streamed execution is requestedXPathException
- if an error occurspublic Sequence<?> makeClosure(Expression expression, int ref, XPathContext context) throws XPathException
expression
- the expression to be evaluatedref
- the (nominal) number of times the value of the expression is requiredcontext
- the XPath dynamic evaluation contextXPathException
- if a failure occurs constructing the Closurepublic GroundedValue<?> makeSequenceExtent(Expression expression, int ref, XPathContext context) throws XPathException
expression
- the expression to be evaluatedref
- the (nominal) number of times the value of the expression is requiredcontext
- the XPath dynamic evaluation contextXPathException
- if evaluation of the expression failspublic StyleNodeFactory makeStyleNodeFactory(Compilation compilation)
compilation
- the compilation episode (compiling one package)public Expression makeEvaluateInstruction(XSLEvaluate source, ComponentDeclaration decl) throws XPathException
XPathException
public StylesheetPackage makeStylesheetPackage()
public AccumulatorRegistry makeAccumulatorRegistry()
public void registerExternalObjectModel(ExternalObjectModel model)
model
- The external object model.
This can either be one of the system-supplied external
object models for JDOM, XOM, or DOM, or a user-supplied external object model.
This method is intended for advanced users only, and is subject to change.
public ExternalObjectModel getExternalObjectModel(java.lang.String uri)
uri
- the identifying URI of the required external object modelpublic ExternalObjectModel getExternalObjectModel(java.lang.Class nodeClass)
nodeClass
- the class of the Node object in the external object modelpublic java.util.List<ExternalObjectModel> getExternalObjectModels()
This method is intended for internal use only.
ExternalObjectModel
public JavaExternalObjectType getJavaExternalObjectType(java.lang.Class theClass)
theClass
- the class in questionpublic java.util.Map<java.lang.String,Function> makeMethodMap(java.lang.Class javaClass, java.lang.String required)
javaClass
- the Java class whose methods are requiredrequired
- if non-null, indicates the key of the entry that is required in the map. If
this parameter is supplied, then the map will be limited to a single entry
with this key, since it is known that the other entries would never be usedjava.lang.UnsupportedOperationException
- except in subclassespublic MapItem externalObjectAsMap(ObjectValue value, java.lang.String required)
value
- the (wrapped) Java object to be convertedrequired
- if non-null, indicates the key of the entry that is required in the map. If
this parameter is supplied, then the map will be limited to a single entry
with this key, since it is known that the other entries would never be used.java.lang.UnsupportedOperationException
- except in subclassespublic Expression makeObjectLookupExpression(Expression lhs, Expression rhs)
public NodeInfo unravel(javax.xml.transform.Source source)
This method is intended for internal use.
source
- A Source representing the wrapped or unwrapped external Node. This will typically
be a DOMSource, but it may be a similar Source recognized by some other registered external
object model.java.lang.IllegalArgumentException
- if the source object is not of a recognized class. This method does
not call the registered to resolve the Source
.public boolean isExtensionElementAvailable(StructuredQName qName)
qName
- the extension element namepublic void setStaticQueryContextFactory(StaticQueryContextFactory factory)
factory
- the factory class to be used when a new StaticQueryContext is required.
Note that this is not used for the default StaticQueryContext held in the Configuration itself.public StaticQueryContext newStaticQueryContext()
public PendingUpdateList newPendingUpdateList()
java.lang.UnsupportedOperationException
- if called when using Saxon-HEpublic PipelineConfiguration makePipelineConfiguration()
public SchemaURIResolver makeSchemaURIResolver(javax.xml.transform.URIResolver resolver)
public static Configuration getConfiguration(XPathContext context)
context
- the XPath dynamic contextpublic void setSourceResolver(SourceResolver resolver)
Source
interface: a user-supplied SourceResolver can handle
such Source objects and translate them to a kind of Source that Saxon understands.resolver
- the source resolver.public SourceResolver getSourceResolver()
public javax.xml.transform.Source resolveSource(javax.xml.transform.Source source, Configuration config) throws XPathException
resolveSource
in interface SourceResolver
source
- A source object, typically the source supplied as the first
argument to Transformer.transform(javax.xml.transform.Source, javax.xml.transform.Result)
or similar methods.config
- The Configuration. This provides the SourceResolver with access to
configuration information; it also allows the SourceResolver to invoke the
resolveSource() method on the Configuration object as a fallback implementation.AugmentedSource
,
NodeInfo
,
or PullSource
. Return null if the Source object is not
recognizedXPathException
- if the Source object is recognized but cannot be processedpublic TreeInfo buildDocumentTree(javax.xml.transform.Source source) throws XPathException
SourceResolver
. This method always constructs a new tree, it never
wraps or returns an existing tree.source
- the Source to be used. This may be an AugmentedSource
, allowing options
to be specified for the way in which this document will be built. If an AugmentedSource
is supplied then options set in the AugmentedSource take precedence over options
set in the Configuration.
If any error occurs reading or parsing the supplied Source, the error is notified
to the ErrorListener
registered with this Configuration
.
XPathException
- if any errors occur during document parsing or validation. Detailed
errors occurring during schema validation will be written to the ErrorListener associated
with the AugmentedSource, if supplied, or with the Configuration otherwise.buildDocument(Source)
method, but adapted to return the
TreeInfo containing information about the constructed tree, including a reference to its root node.public TreeInfo buildDocumentTree(javax.xml.transform.Source source, ParseOptions parseOptions) throws XPathException
source
- the source of the document to be constructed. If this is an
AugmentedSource, then any parser options contained in the AugmentedSource take precedence
over options specified in the parseOptions argument.parseOptions
- options for parsing and constructing the document. Any options that
are not explicitly set in parseOptions default first to the values supplied in the source
argument if it is an AugmentedSource, and then to the values set in this Configuration.
The supplied parseOptions object is not modified.XPathException
- if parsing fails, or if the Source represents a node other than
a document nodebuildDocument(Source, ParseOptions)
method, but adapted to return the
TreeInfo containing information about the constructed tree, including a reference to its root node.public DocumentInfo buildDocument(javax.xml.transform.Source source) throws XPathException
buildDocumentTree(Source)
.SourceResolver
.source
- the Source to be used. This may be an AugmentedSource
, allowing options
to be specified for the way in which this document will be built. If an AugmentedSource
is supplied then options set in the AugmentedSource take precedence over options
set in the Configuration.
From Saxon 9.2, this method always creates a new tree, it never wraps or returns an existing tree.
If any error occurs reading or parsing the supplied Source, the error is notified
to the ErrorListener
registered with this Configuration
.
XPathException
- if any errors occur during document parsing or validation. Detailed
errors occurring during schema validation will be written to the ErrorListener associated
with the AugmentedSource, if supplied, or with the Configuration otherwise.public DocumentInfo buildDocument(javax.xml.transform.Source source, ParseOptions parseOptions) throws XPathException
buildDocumentTree(Source, ParseOptions)
.source
- the source of the document to be constructed. If this is an
AugmentedSource, then any parser options contained in the AugmentedSource take precedence
over options specified in the parseOptions argument.parseOptions
- options for parsing and constructing the document. Any options that
are not explicitly set in parseOptions default first to the values supplied in the source
argument if it is an AugmentedSource, and then to the values set in this Configuration.
The supplied parseOptions object is not modified.XPathException
- if parsing fails, or if the Source represents a node other than
a document nodepublic TreeStatistics getTreeStatistics()
public Receiver makeEmitter(java.lang.String clarkName, java.util.Properties props) throws XPathException
clarkName
- the QName of the user-supplied ContentHandler (requested as a prefixed
value of the method attribute in xsl:output, or anywhere that serialization parameters
are allowed), encoded in Clark format as {uri}localprops
- the properties to be used in the case of a dynamically-loaded ContentHandler.XPathException
- if a failure occurs creating the Emitterpublic void setConfigurationProperty(java.lang.String name, java.lang.Object value)
From Saxon 9.9, an alternative interface is available: setConfigurationProperty(Feature, Object)
.
The new interface is more efficient because it avoids expensive string comparisons. The old interface is
retained mainly for compatibility, and also because there are a few cases where it cannot easily be replaced,
for example when using composite feature URIs to delegate configuration options to the XML parser.
name
- the URI identifying the property to be set. See the class FeatureKeys
for
constants representing the property names that can be set.value
- the value of the property. Note that boolean values may be supplied either as a Boolean,
or as one of the strings "0", "1", "true", "false", "yes", "no", "on", or "off".java.lang.IllegalArgumentException
- if the property name is not recognized or if the value is not
a valid value for the named propertypublic <T> void setConfigurationProperty(Feature<T> feature, T value)
feature
- the property to be set. See the class Feature
for
constants representing the property names that can be set.value
- the value of the property. Note that boolean values may be supplied either as a Boolean,
or as one of the strings "0", "1", "true", "false", "yes", "no", "on", or "off".java.lang.IllegalArgumentException
- if the property name is not recognized or if the value is not
a valid value for the named propertypublic static boolean requireBoolean(java.lang.String propertyName, java.lang.Object value)
propertyName
- the name of the propertyvalue
- the supplied value of the property. This may be either a java.lang.Boolean, or a string
taking one of the values on|off, true|false, yes|no, or 1|0 (suited to the conventions of different
configuration APIs that end up calling this method)java.lang.IllegalArgumentException
- if the supplied value cannot be validated as a recognized boolean valueprotected int requireInteger(java.lang.String propertyName, java.lang.Object value)
propertyName
- the name of the propertyvalue
- the supplied value of the property. This may be either a java.lang.Integer, or a string
that can be parsed as an integer (suited to the conventions of different
configuration APIs that end up calling this method)java.lang.IllegalArgumentException
- if the supplied value cannot be validated as a recognized boolean valueprotected void internalSetBooleanProperty(Feature property, java.lang.Object value)
property
- the name of the property to be setvalue
- a representation of the boolean value.
This may be either a java.lang.Boolean, or a string
taking one of the values on|off, true|false, yes|no, or 1|0 (suited to the conventions of different
configuration APIs that end up calling this method)public boolean getBooleanProperty(Feature feature)
feature
- the integer code of the required property. See the class FeatureCode
for
constants representing the property names that can be requested. This class only recognizes
properties whose type is boolean.public void setBooleanProperty(java.lang.String propertyName, boolean value)
propertyName
- the name of the required property. See the class FeatureKeys
for
constants representing the property names that can be requested. This class only recognizes
properties whose type is boolean.value
- the value of the property.java.lang.IllegalArgumentException
- if the property name is not recognized (as a property whose expected
value is boolean)public void setBooleanProperty(Feature<java.lang.Boolean> feature, boolean value)
feature
- the required property. See the class Feature
for
constants representing the property names that can be requested. This class only recognizes
properties whose type is boolean.value
- the value of the property.java.lang.IllegalArgumentException
- if the feature is not recognized (as a feature whose expected
value is boolean)protected java.lang.String requireString(java.lang.String propertyName, java.lang.Object value)
protected java.lang.Object instantiateClassName(java.lang.String propertyName, java.lang.Object value, java.lang.Class<?> requiredClass)
public java.lang.Object getConfigurationProperty(java.lang.String name)
name
- the name of the required property. See the class FeatureKeys
for
constants representing the property names that can be requested.java.lang.IllegalArgumentException
- thrown if the property is not one that Saxon recognizes.public <T> T getConfigurationProperty(Feature<T> feature)
feature
- the required property. See the class Feature
for
constants representing the properties that can be requested.java.lang.IllegalArgumentException
- thrown if the property is not one that Saxon recognizes.public boolean isGenerateByteCode(int hostLanguage)
hostLanguage
- one of XSLT or XQUERYpublic boolean isDeferredByteCode(int hostLanguage)
hostLanguage
- one of XSLT or XQUERYpublic boolean isJITEnabled()
public void close()
public IPackageLoader makePackageLoader()
public InvalidityReportGenerator createValidityReporter()
public int getCountDown()
public SimpleMode makeMode(StructuredQName modeName, CompilerInfo compilerInfo)
modeName
- the name of the modecompilerInfo
- information on the compiler, that can alter rule optimizationpublic TemplateRule makeTemplateRule()
public XPathContextMajor.ThreadManager makeThreadManager()
public CompilerInfo makeCompilerInfo()
public ICompilerService makeCompilerService(int hostLanguage)
hostLanguage
- eg Configuration.XSLTpublic void createByteCodeReport(java.lang.String fileName)
fileName
- the specified file namepublic void setLabel(java.lang.String label)
label
- the label to associatepublic java.lang.String getLabel()
Copyright (c) 2004-2020 Saxonica Limited. All rights reserved.