|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.saxon.Configuration
public class Configuration
This class holds details of user-selected configuration options for a set of transformations and/or queries. When running XSLT, the preferred way of setting configuration options is via the JAXP TransformerFactory interface, but the Configuration object provides a finer level of control. As yet there is no standard API for XQuery, so the only way of setting Configuration information is to use the methods on this class directly.
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.
Nested Class Summary | |
---|---|
static class |
Configuration.LicenseFeature
This class contains constants representing features of the software that may or may not be licensed. |
Field Summary | |
---|---|
static Class<? extends Configuration> |
configurationClass
|
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 int |
optimizationLevel
|
protected Optimizer |
optimizer
|
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. |
static String |
softwareEdition
|
protected VendorFunctionLibrary |
vendorFunctionLibrary
|
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 Summary | |
---|---|
Configuration()
Create a non-schema-aware configuration object with default settings for all options. |
Method Summary | |
---|---|
void |
addExtensionBinders(FunctionLibraryList list)
Add the registered extension binders to a function library. |
void |
addSchemaForBuiltInNamespace(String namespace)
Add a built-in schema for a given namespace. |
void |
addSchemaSource(Source schemaSource)
Load a schema, which will be available for use by all subsequent operations using this Configuration. |
void |
addSchemaSource(Source schemaSource,
ErrorListener errorListener)
Load a schema, which will be available for use by all subsequent operations using this EnterpriseConfiguration. |
DocumentInfo |
buildDocument(Source source)
Build a document tree, using options set on this Configuration and on the supplied source object. |
DocumentInfo |
buildDocument(Source source,
ParseOptions parseOptions)
Build a document, using specified options for parsing and building. |
void |
checkLicensedFeature(int feature,
String name)
Check whether a particular feature is licensed, with a fatal error if it is not |
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 |
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. |
Receiver |
getAnnotationStripper(Receiver destination)
Add to a pipeline a receiver that strips all type annotations. |
SchemaDeclaration |
getAttributeDeclaration(int fingerprint)
Get a global attribute declaration. |
CharacterSetFactory |
getCharacterSetFactory()
Get the CharacterSetFactory. |
Class |
getClass(String className,
boolean tracing,
ClassLoader classLoader)
Load a class using the class name provided. |
CollationMap |
getCollationMap()
Get the collation map, which can be used to register named collations (and a default collation) at the Configuration level. |
CollationURIResolver |
getCollationURIResolver()
Get the collation URI resolver associated with this configuration. |
CollectionURIResolver |
getCollectionURIResolver()
Get the collection URI resolver associated with this configuration. |
static Configuration |
getConfiguration(XPathContext context)
Get the configuration, given the context. |
Object |
getConfigurationProperty(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. |
Debugger |
getDebugger()
Get the debugger in use. |
String |
getDefaultCollection()
Get the URI of the default collection. |
String |
getDefaultCountry()
Get the default country to be used for number and date formatting when no country is specified. |
String |
getDefaultLanguage()
Get the default language. |
Properties |
getDefaultSerializationProperties()
Get the default serialization 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,
String systemId,
int validationMode,
int stripSpace,
SchemaType schemaType,
int topLevelElementName)
Get a document-level validator to add to a Receiver pipeline. |
int |
getDOMLevel()
Get the level of DOM interface to be used |
DynamicLoader |
getDynamicLoader()
Get the DynamicLoader used by this Configuration. |
String |
getEditionCode()
Get the edition code identifying this configuration: "HE", "PE" or "EE" |
SchemaDeclaration |
getElementDeclaration(int fingerprint)
Get a global element declaration. |
SchemaDeclaration |
getElementDeclaration(StructuredQName qName)
Get a global element declaration. |
SequenceReceiver |
getElementValidator(SequenceReceiver receiver,
NodeName elemName,
int locationId,
SchemaType schemaType,
int validation)
Get a Receiver that can be used to validate an element, and that passes the validated element on to a target receiver. |
ErrorListener |
getErrorListener()
Get the ErrorListener used in this configuration. |
Iterator<? extends SchemaType> |
getExtensionsOfType(SchemaType type)
Get the set of complex types that have been defined as extensions of a given type. |
ExternalObjectModel |
getExternalObjectModel(Class nodeClass)
Get the external object model that recognizes a particular class of node, if available |
ExternalObjectModel |
getExternalObjectModel(String uri)
Get the external object model with a given URI, if registered |
List<ExternalObjectModel> |
getExternalObjectModels()
Get all the registered external object models. |
protected ExternalObjectType |
getExternalObjectType(int fingerprint)
Get the external object type corresponding to a fingerprint if it is indeed an external object type, otherwise return null |
DocumentPool |
getGlobalDocumentPool()
Get the global document pool. |
int |
getHostLanguage()
Get the host language used in this configuration. |
Set |
getImportedNamespaces()
Get the set of namespaces of imported schemas |
Object |
getInstance(String className,
ClassLoader classLoader)
Instantiate a class using the class name provided. |
IntegratedFunctionLibrary |
getIntegratedFunctionLibrary()
Get the IntegratedFunction library containing integrated extension functions |
static Locale |
getLocale(String lang)
Get a locale given a language code in XML format. |
LocalizerFactory |
getLocalizerFactory()
Get the localizer factory in use |
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. |
NameChecker |
getNameChecker()
Get a class that can be used to check names against the selected XML version |
NamePool |
getNamePool()
Get the target namepool to be used for stylesheets/queries and for source documents. |
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 |
static Platform |
getPlatform()
Get the Platform to be used for platform-dependent methods |
Object |
getProcessor()
Get the Processor object that created this Configuration in the relevant API. |
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. |
SchemaType |
getSchemaType(int fingerprint)
Get the top-level schema type definition with a given fingerprint. |
SchemaURIResolver |
getSchemaURIResolver()
Get the user-defined SchemaURIResolver for resolving URIs used in "import schema" declarations; if none has been explicitly set, returns null. |
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. |
XMLReader |
getSourceParser()
Get a parser for source documents. |
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. |
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 |
getStripsWhiteSpace()
Set which kinds of whitespace-only text node should be stripped. |
XMLReader |
getStyleParser()
Get the parser for stylesheet documents. |
String |
getStyleParserClass()
Get the name of the class that will be instantiated to create an XML parser for parsing stylesheet modules. |
StandardURIResolver |
getSystemURIResolver()
Get the system-defined URI Resolver. |
TraceListener |
getTraceListener()
Get the TraceListener used for run-time tracing of instruction execution. |
String |
getTraceListenerClass()
Get the name of the trace listener class to be used for run-time tracing of instruction execution. |
int |
getTreeModel()
Get the Tree Model used by this Configuration. |
TypeHierarchy |
getTypeHierarchy()
Get the TypeHierarchy: a cache holding type information |
URIResolver |
getURIResolver()
Get the URIResolver used in this configuration |
VendorFunctionLibrary |
getVendorFunctionLibrary()
Get the FunctionLibrary used to bind calls on Saxon-defined extension functions. |
int |
getXMLVersion()
Get the XML version to be used by default for validating characters and names |
int |
getXsdVersion()
Get the version of XML Schema to be used |
void |
importComponents(Source source)
Import a precompiled Schema Component Model from a given Source. |
protected void |
init()
|
protected Object |
instantiateClassName(String propertyName,
Object value,
Class requiredClass)
|
boolean |
isAllowExternalFunctions()
Determine whether calls to external Java functions are permitted. |
boolean |
isCompatible(Configuration other)
Determine whether two Configurations are compatible. |
boolean |
isCompileWithTracing()
Determine whether compile-time generation of trace code was requested |
boolean |
isDebugBytecode()
This option is set to indicate that bytecode generation should be run in debugging mode. |
boolean |
isDeclaredNotation(String uri,
String local)
Ask whether a given notation has been declared in the schema |
boolean |
isDisplayBytecode()
This option is set to indicate that bytecode generation should be run in display mode. |
boolean |
isExpandAttributeDefaults()
Determine whether elements and attributes that have a fixed or default value are to be expanded. |
boolean |
isGenerateByteCode(int hostLanguage)
Ask whether bytecode should be generated. |
boolean |
isLazyConstructionMode()
Determine whether lazy construction mode is on or off. |
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 |
isMultiThreading()
Determine whether multithreading optimizations are allowed |
boolean |
isOptimizerTracing()
Test whether optimizer tracing is on or off |
boolean |
isRetainDTDAttributeTypes()
Ask whether attribute types obtained from a DTD are to be used to set type annotations on the resulting nodes |
boolean |
isSchemaAvailable(String targetNamespace)
Determine whether the Configuration contains a cached schema for a given target namespace |
boolean |
isSchemaAware(int language)
Deprecated. since 9.2: use isLicensedFeature() instead |
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 to System.err. |
boolean |
isTraceExternalFunctions()
Determine whether calls on external functions are to be traced for diagnostic purposes. |
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(String absoluteURI)
Simple interface to load a schema document |
static InputStream |
locateResource(String filename,
List<String> messages,
List<ClassLoader> loaders)
Read a resource file issued with the Saxon product |
Value |
makeClosure(Expression expression,
int ref,
XPathContext context)
Make a Closure, given the expected reference count |
FilterFactory |
makeDocumentProjector(PathMap.PathMapRoot map)
Create a document projector for a given path map. |
Receiver |
makeEmitter(String clarkName,
Properties props)
Load a named output emitter or SAX2 ContentHandler and check it is OK. |
static Configuration |
makeLicensedConfiguration(ClassLoader classLoader,
String className)
Static method to instantiate a professional or enterprise configuration. |
Numberer |
makeNumberer(String language,
String country)
Load a Numberer class for a given language and check it is OK. |
XMLReader |
makeParser(String className)
Create a new SAX XMLReader object using the class name provided. |
PipelineConfiguration |
makePipelineConfiguration()
Make a PipelineConfiguration from the properties of this Configuration |
static Configuration |
makeSchemaAwareConfiguration(ClassLoader loader,
String className)
Deprecated. since 9.2. Use makeLicensedConfiguration(java.lang.ClassLoader, java.lang.String) instead. |
ValueRepresentation |
makeSequenceExtent(Expression expression,
int ref,
XPathContext context)
Make a SequenceExtent, given the expected reference count |
SlotManager |
makeSlotManager()
Factory method to create a SlotManager. |
Receiver |
makeStreamingTransformer(XPathContext context,
Mode mode)
Create a streaming transformer |
StyleNodeFactory |
makeStyleNodeFactory()
Factory method to get the StyleNodeFactory, used for constructing elements in a stylesheet document |
TraceListener |
makeTraceListener()
Get or create the TraceListener used for run-time tracing of instruction execution. |
TraceListener |
makeTraceListener(String className)
Create an instance of a TraceListener with a specified class name |
NodeInfo |
makeUnconstructedDocument(DocumentInstr instr,
XPathContext context)
Make an "unconstructed" (that is, lazily-constructed) document node |
NodeInfo |
makeUnconstructedElement(ElementCreator instr,
XPathContext context)
Make an "unconstructed" (that is, lazily-constructed) element node |
URIResolver |
makeURIResolver(String className)
Create an instance of a URIResolver with a specified class name. |
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 specified in the edition.properties properties file: that is, the type of Configuration appropriate to the edition of the software being used. |
ExpressionParser |
newExpressionParser(String language,
boolean updating,
DecimalValue 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)
Make a UserFunction object. |
Optimizer |
obtainOptimizer()
Factory method to get an Optimizer. |
static Configuration |
readConfiguration(Source source)
Factory method to construct a Configuration object by reading a configuration file. |
protected Configuration |
readConfigurationFile(Source source)
Read the configuration file an construct a new Configuration (the real one) |
String |
readInlineSchema(NodeInfo root,
String expected,
ErrorListener errorListener)
Read an inline schema from a stylesheet. |
void |
readMultipleSchemas(PipelineConfiguration pipe,
String baseURI,
Collection schemaLocations,
String expected)
Read schemas from a list of schema locations. |
String |
readSchema(PipelineConfiguration pipe,
String baseURI,
String schemaLocation,
String expected)
Read a schema from a given schema location This method is intended for internal use. |
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 |
reportFatalError(XPathException err)
Report a fatal error |
protected boolean |
requireBoolean(String propertyName,
Object value)
Validate a property value where the required type is boolean |
protected String |
requireString(String propertyName,
Object value)
|
Source |
resolveSource(Source source,
Configuration config)
Resolve a Source. |
void |
reuseSourceParser(XMLReader parser)
Return a source parser to the pool, for reuse |
void |
reuseStyleParser(XMLReader parser)
Return a stylesheet (or schema) parser to the pool, for reuse |
void |
sealNamespace(String namespace)
Mark a schema namespace as being sealed. |
void |
setAllowExternalFunctions(boolean allowExternalFunctions)
Determine whether calls to external Java functions are permitted. |
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 |
setCollectionURIResolver(CollectionURIResolver resolver)
Set a CollectionURIResolver to be used to resolve collection URIs (that is, the URI supplied in a call to the collection() function). |
void |
setCompileWithTracing(boolean trace)
Request compile-time generation of trace code (or not) |
void |
setConfigurationProperty(String name,
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 |
setDebugBytecode(boolean debugBytecode)
This option is set to indicate that bytecode generation should be run in debugging mode. |
void |
setDebugger(Debugger debugger)
Set the debugger to be used. |
void |
setDefaultCollection(String uri)
Set the default collection. |
void |
setDefaultCountry(String country)
Set the default country to be used for number and date formatting when no country is specified. |
void |
setDefaultLanguage(String language)
Set the default language to be used for number and date formatting when no language is specified. |
void |
setDefaultSerializationProperties(Properties props)
Set the default serialization properties |
void |
setDisplayBytecode(boolean displayBytecode)
This option is set to indicate that bytecode generation should be run in display mode. |
void |
setDocumentNumberAllocator(DocumentNumberAllocator allocator)
Set the document number allocator. |
void |
setDOMLevel(int level)
Set the level of DOM interface to be used |
void |
setDynamicLoader(DynamicLoader dynamicLoader)
Set the DynamicLoader to be used. |
void |
setErrorListener(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 |
setGenerateByteCode(boolean compileToBytecode)
Say whether bytecode should be generated. |
void |
setHostLanguage(int hostLanguage)
Set the host language used in this configuration. |
void |
setLazyConstructionMode(boolean lazy)
Set lazy construction mode on or off. |
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 |
setMessageEmitterClass(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(String className)
Create and register an instance of a ModuleURIResolver with a specified class name. |
void |
setMultiThreading(boolean multithreading)
Set whether multithreading optimizations are allowed. |
void |
setNamePool(NamePool targetNamePool)
Set the NamePool to be used for stylesheets/queries and for source documents. |
void |
setOptimizerTracing(boolean trace)
Set optimizer tracing on or off |
void |
setOutputURIResolver(OutputURIResolver outputURIResolver)
Set the OutputURIResolver that will be used to resolve URIs used in the href attribute of the xsl:result-document instruction. |
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(Object processor)
Save the Processor object that owns this Configuration in the relevant API. |
void |
setRecoveryPolicy(int recoveryPolicy)
Determine how recoverable run-time errors are to be handled. |
void |
setRetainDTDAttributeTypes(boolean useTypes)
Deprecated. since 9.2 This feature was dropped from the final XDM specification and will be dropped in a future Saxon release. The facility is supported only in Saxon-EE. Use an XSD schema to define the attribute types instead. |
void |
setSchemaURIResolver(SchemaURIResolver resolver)
Set a user-defined SchemaURIResolver for resolving URIs used in "import schema" declarations. |
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(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(PrintStream out)
Set the standard error output to be used in all cases where no more specific destination is defined. |
void |
setStripsAllWhiteSpace(boolean stripsAllWhiteSpace)
Determine whether whitespace-only text nodes are to be stripped unconditionally from source documents. |
void |
setStripsWhiteSpace(int kind)
Set which kinds of whitespace-only text node should be stripped. |
void |
setStyleParserClass(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 to System.err. |
void |
setTraceExternalFunctions(boolean traceExternalFunctions)
Determine whether calls on external functions are to be traced for diagnostic purposes. |
void |
setTraceListener(TraceListener traceListener)
Set the TraceListener to be used for run-time tracing of instruction execution. |
void |
setTraceListenerClass(String className)
Set the name of the trace listener class to be used for run-time tracing of instruction execution. |
void |
setTreeModel(int treeModel)
Set the Tree Model used by this Configuration. |
void |
setURIResolver(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(Source source)
Get a NodeInfo corresponding to a DOM or other external Node, either by wrapping or unwrapping the external Node. |
boolean |
useTypedValueCache()
Ask whether the typed value cache should be used for the TinyTree |
SimpleType |
validateAttribute(int nameCode,
CharSequence value,
int validation)
Validate an attribute value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Class<? extends Configuration> configurationClass
public static final String softwareEdition
protected int xsdVersion
protected VendorFunctionLibrary vendorFunctionLibrary
protected Optimizer optimizer
protected int optimizationLevel
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
Constructor Detail |
---|
public Configuration()
Method Detail |
---|
public static InputStream locateResource(String filename, List<String> messages, List<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 resource
public static Configuration readConfiguration(Source source) throws XPathException
source
- Source object containing the configuration file
XPathException
- if the configuration file cannot be read
or is invalidprotected Configuration readConfigurationFile(Source source) throws XPathException
source
- the source of the configuration file
XPathException
- if the configuration file cannot be read or is invalidpublic static Configuration newConfiguration()
protected void init()
public static Configuration makeLicensedConfiguration(ClassLoader classLoader, String className) throws 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.
RuntimeException
- if the required Saxon edition cannot be loadedpublic static Configuration makeSchemaAwareConfiguration(ClassLoader loader, String className)
makeLicensedConfiguration(java.lang.ClassLoader, java.lang.String)
instead.
loader
- the class loader (or null)className
- the name of the configuration class (or null)
makeLicensedConfiguration(java.lang.ClassLoader, java.lang.String)
public String getEditionCode()
public void setProcessor(Object processor)
processor
- This can be any object, but it is actually used to hold one of the
following:
net.sf.saxon.s9api.Processor
Saxon.Api.Processor
TransformerFactory
XPathFactory
SchemaFactory
XQDataSource
public Object 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(Object)
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
public String getProductTitle()
public void checkLicensedFeature(int feature, String name) throws LicenseException
feature
- the feature in question, identified by a constant in class Configuration.LicenseFeature
name
- the name of the feature for use in diagnostics
LicenseException
- if the feature is not licensed. This is a RunTimeException, so it will normally be fatal.public boolean isLicensedFeature(int feature)
feature
- the feature in question, identified by a constant in class Configuration.LicenseFeature
public boolean isSchemaAware(int language)
language
- the required host language: XSLT, XQUERY, or XML_SCHEMA
public void displayLicenseMessage()
public int getHostLanguage()
Container.getHostLanguage()
.
Internally its only use is in deciding (in Saxon-EE only) which error listener to
use by default at compile time, and since the standard XSLT and XQuery listeners have
no differences when used for static errors, the choice is immaterial.
public void setHostLanguage(int hostLanguage)
hostLanguage
- Configuration.XSLT or Configuration.XQUERYpublic static Platform getPlatform()
public 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 overridden
dynamicLoader
- the DynamicLoader to be used by this Configurationpublic DynamicLoader getDynamicLoader()
public Class getClass(String className, boolean tracing, ClassLoader classLoader) throws XPathException
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 Object getInstance(String className, ClassLoader classLoader) throws XPathException
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 URIResolver getURIResolver()
public void setURIResolver(URIResolver resolver)
resolver
- The URIResolver to be used.public void setParameterizedURIResolver()
public StandardURIResolver getSystemURIResolver()
public URIResolver makeURIResolver(String className) throws TransformerException
className
- The fully-qualified name of the URIResolver class
TransformerException
- if the requested class does not
implement the javax.xml.transform.URIResolver interfacepublic ErrorListener getErrorListener()
public void setErrorListener(ErrorListener listener)
listener
- the ErrorListener to be usedpublic void reportFatalError(XPathException err)
err
- the exception to be reportedpublic void setStandardErrorOutput(PrintStream out)
out
- the stream to be used for error output where no more specific destination
has been suppliedpublic PrintStream getStandardErrorOutput()
public void setMultiThreading(boolean multithreading)
saxon:threads
attribute of xsl:for-each
.
However, it can be disabled by setting this option to false.
multithreading
- true if multithreading optimizations are allowed. Default is true for Saxon-EE,
false for Saxon-HE and Saxon-PEpublic boolean isMultiThreading()
public void setXMLVersion(int version)
version
- one of the constants XML10 or XML11public int getXMLVersion()
XML10
or XML11
public ParseOptions getParseOptions()
public NameChecker getNameChecker()
public void setConversionRules(ConversionRules rules)
rules
- the conversion rules to be usedpublic ConversionRules getConversionRules()
public int getXsdVersion()
XSD10
or XSD11
public XPathContext getConversionContext()
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 useTypedValueCache()
public 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(String className)
TraceListener
.
className
- the name of the trace listener class. If null, any existing trace listener is
removed from the configuration.
IllegalArgumentException
- if the class cannot be instantiated or does not implement
TraceListenerpublic String getTraceListenerClass()
TraceListener
.
public boolean isCompileWithTracing()
public void setCompileWithTracing(boolean trace)
trace
- true if compile-time generation of trace code is requiredpublic void setOptimizerTracing(boolean trace)
trace
- set to true to switch optimizer tracing on, false to switch it offpublic boolean isOptimizerTracing()
public TraceListener makeTraceListener(String className) throws XPathException
className
- The fully qualified class name of the TraceListener to
be constructed
XPathException
- if the requested class does not
implement the net.sf.saxon.trace.TraceListener interfacepublic 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 VendorFunctionLibrary getVendorFunctionLibrary()
public void addExtensionBinders(FunctionLibraryList list)
list
- the function library listpublic UserFunction newUserFunction(boolean memoFunction)
memoFunction
- true if the function is to be a memo function, This option is ignored
in Saxon-HE.
public void setCollationURIResolver(CollationURIResolver resolver)
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 resolver
public CollationMap getCollationMap()
public void setDefaultCollection(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 String getDefaultCollection()
public void setCollectionURIResolver(CollectionURIResolver resolver)
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()
setCollectionURIResolver(net.sf.saxon.lib.CollectionURIResolver)
method; if this has not been called, it returns the system-defined collection URI resolver
public void setLocalizerFactory(LocalizerFactory factory)
factory
- the LocalizerFactorypublic LocalizerFactory getLocalizerFactory()
public void setDefaultLanguage(String language)
language
- the default language to be used, as an ISO code for example "en" or "fr-CA"public String getDefaultLanguage()
public void setDefaultCountry(String country)
country
- the default country to be used, as an ISO code for example "US" or "GB"public String getDefaultCountry()
public Numberer makeNumberer(String language, 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 country
public 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(String className) throws TransformerException
className
- The fully-qualified name of the LocationHintResolver class
TransformerException
- if the requested class does not
implement the net.sf.saxon.LocationHintResolver interfacepublic ModuleURIResolver getModuleURIResolver()
public ModuleURIResolver getStandardModuleURIResolver()
public void setSchemaURIResolver(SchemaURIResolver resolver)
resolver
- the URI resolver used for import schema declarations. May be null,
in which case any existing URI resolver is removed from the Configuration.public SchemaURIResolver getSchemaURIResolver()
public CompilerInfo getDefaultXsltCompilerInfo()
public StaticQueryContext getDefaultStaticQueryContext()
public 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 String getMessageEmitterClass()
public void setMessageEmitterClass(String messageReceiverClassName)
messageReceiverClassName
- the full class name of the message receiver. This
must implement net.sf.saxon.event.Receiver.public String getSourceParserClass()
public void setSourceParserClass(String sourceParserClass)
sourceParserClass
- the fully qualified name of the XML parser class. This must implement
the SAX2 XMLReader interface.public String getStyleParserClass()
public void setStyleParserClass(String parser)
parser
- the fully qualified name of the XML parser classpublic OutputURIResolver getOutputURIResolver()
public void setOutputURIResolver(OutputURIResolver outputURIResolver)
outputURIResolver
- the OutputURIResolver to be used.public void setSerializerFactory(SerializerFactory factory)
factory
- a custom SerializerFactorypublic SerializerFactory getSerializerFactory()
public CharacterSetFactory getCharacterSetFactory()
public void setDefaultSerializationProperties(Properties props)
props
- the default propertiespublic Properties getDefaultSerializationProperties()
public boolean isTiming()
public void setTiming(boolean timing)
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 isAllowExternalFunctions()
public void setAllowExternalFunctions(boolean allowExternalFunctions)
Setting the value to false disallows all of the following:
xsl:result-document
instructionNote that this option does not disable use of the doc()
function or similar
functions to access the filestore of the machine where the transformation or query is running.
That should be done using a user-supplied URIResolver
allowExternalFunctions
- true if external function calls are to be
permitted.public boolean isTraceExternalFunctions()
public void setRetainDTDAttributeTypes(boolean useTypes) throws TransformerFactoryConfigurationError
useTypes
- set to true if DTD types are to be taken into account
TransformerFactoryConfigurationError
- if called in Saxon-HEpublic boolean isRetainDTDAttributeTypes()
public void setTraceExternalFunctions(boolean traceExternalFunctions)
traceExternalFunctions
- true if tracing is to be enabled
for calls to external Java functionspublic boolean isValidation()
public void setValidation(boolean validation)
validation
- true if DTD validation is to be requested.public FilterFactory makeDocumentProjector(PathMap.PathMapRoot map)
map
- the path map used to control document projection
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 final TypeHierarchy getTypeHierarchy()
public DocumentNumberAllocator getDocumentNumberAllocator()
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)
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 one
public DocumentPool getGlobalDocumentPool()
public boolean isStripsAllWhiteSpace()
public void setStripsAllWhiteSpace(boolean stripsAllWhiteSpace)
stripsAllWhiteSpace
- if all whitespace-only text nodes are to be stripped.public void setStripsWhiteSpace(int kind)
kind
- the kind of whitespace-only text node that should be stripped when building
a source tree. One of Whitespace.NONE
(none), Whitespace.ALL
(all),
or Whitespace.IGNORABLE
(element-content whitespace as defined in a DTD or schema)public int getStripsWhiteSpace()
Whitespace.NONE
(none), Whitespace.ALL
(all),
or Whitespace.IGNORABLE
(element-content whitespace as defined in a DTD or schema)public XMLReader getSourceParser() throws TransformerFactoryConfigurationError
setValidation(boolean)
setting.
TransformerFactoryConfigurationError
- if a failure occurs
configuring the parser for use.public void reuseSourceParser(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 XMLReader getStyleParser() throws TransformerFactoryConfigurationError
TransformerFactoryConfigurationError
- if an error occurs
configuring the parserpublic void reuseStyleParser(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(String absoluteURI) throws SchemaException
absoluteURI
- the absolute URI of the location of the schema document
SchemaException
- if the schema document at the given location cannot be read or is invalidpublic String readSchema(PipelineConfiguration pipe, String baseURI, String schemaLocation, String expected) throws SchemaException
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 expectation
UnsupportedOperationException
- when called in the non-schema-aware version of the product
SchemaException
- if the schema cannot be readpublic void readMultipleSchemas(PipelineConfiguration pipe, String baseURI, Collection schemaLocations, String expected) throws SchemaException
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 schema
SchemaException
- if an error occurspublic String readInlineSchema(NodeInfo root, String expected, ErrorListener errorListener) throws SchemaException
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(Source schemaSource) throws SchemaException
schemaSource
- the JAXP Source object identifying the schema document to be loaded
SchemaException
- if the schema cannot be read or parsed or if it is invalid
UnsupportedOperationException
- if the configuration is not schema-awarepublic void addSchemaSource(Source schemaSource, 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(String namespace)
namespace
- the namespace. Currently built-in schemas are available for the XML and FN namespacespublic boolean isSchemaAvailable(String targetNamespace)
targetNamespace
- the target namespace of the schema being sought (supply "" for the
unnamed namespace)
public void clearSchemaCache()
public Set getImportedNamespaces()
public void sealNamespace(String namespace)
namespace
- the namespace URI of the components to be sealedpublic Iterator<? extends SchemaType> getExtensionsOfType(SchemaType type)
type
- the type whose extensions are required
public void importComponents(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 document
XPathException
- if a failure occurspublic SchemaDeclaration getElementDeclaration(int fingerprint)
fingerprint
- the NamePool fingerprint of the name of the required
element declaration
public SchemaDeclaration getElementDeclaration(StructuredQName qName)
qName
- the name of the required
element declaration
public SchemaDeclaration getAttributeDeclaration(int fingerprint)
fingerprint
- the namepool fingerprint of the required attribute
declaration
public SchemaType getSchemaType(int fingerprint)
fingerprint
- the fingerprint of the schema type
public boolean isDeclaredNotation(String uri, String local)
isDeclaredNotation
in interface NotationSet
uri
- the targetNamespace of the notationlocal
- the local part of the notation name
protected ExternalObjectType getExternalObjectType(int fingerprint)
fingerprint
- the name of the type
public 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 declaration
SchemaException
- if the derivation is not allowedpublic Receiver getDocumentValidator(Receiver receiver, String systemId, int validationMode, int stripSpace, SchemaType schemaType, int topLevelElementName)
receiver
- The receiver to which events should be sent after validationsystemId
- the base URI of the document being validatedvalidationMode
- for example Validation.STRICT or Validation.STRIP. The integer may
also have the bit Validation.VALIDATE_OUTPUT set, indicating that the strean being validated
is to be treated as a final output stream (which means multiple errors can be reported)stripSpace
- options for space strippingschemaType
- The type against which the outermost element of the document must be validated
(null if there is no constraint)topLevelElementName
- the namepool name code of the required top-level element in the instance
document, or -1 if there is no specific element required
public SequenceReceiver getElementValidator(SequenceReceiver receiver, NodeName elemName, int locationId, SchemaType schemaType, int validation) throws XPathException
receiver
- the target receiver tp receive the validated elementelemName
- the name of the element to be validated. This must correspond to the
name of an element declaration in a loaded schemalocationId
- current location in the stylesheet or queryschemaType
- the schema type (typically a complex type) against which the element is to
be validatedvalidation
- The validation mode, for example Validation.STRICT or Validation.LAX
XPathException
- if a validator for the element cannot be createdpublic SimpleType validateAttribute(int nameCode, CharSequence value, int validation) throws ValidationException
nameCode
- the name of the attributevalue
- the value of the attribute as a stringvalidation
- STRICT or LAX
ValidationException
- if the value is invalidpublic Receiver getAnnotationStripper(Receiver destination)
destination
- the Receiver that events will be written to after whitespace stripping
public XMLReader makeParser(String className) throws TransformerFactoryConfigurationError
className
- A string containing the name of the
SAX parser class, for example "com.microstar.sax.LarkDriver"
TransformerFactoryConfigurationError
- if a failure
occurs configuring the parser of this classpublic ExpressionParser newExpressionParser(String language, boolean updating, DecimalValue languageVersion)
language
- set to "XP" (XPath) or "XQ" (XQuery)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 "1.0", "3.0")
UnsupportedOperationException
- if a parser that supports update syntax is requested on Saxon-Bpublic static Locale getLocale(String lang)
lang
- the language code
public void setDebugger(Debugger debugger)
debugger
- the debugger to be used, or null if no debugger is to be usedpublic Debugger getDebugger()
public SlotManager makeSlotManager()
public Receiver makeStreamingTransformer(XPathContext context, Mode mode) throws XPathException
context
- the initial XPath contextmode
- the initial mode, which must be a streaming mode
XPathException
- if a streaming transformer cannot be created (which
is always the case in Saxon-HE and Saxon-PE)public Optimizer obtainOptimizer()
public Value 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 context
XPathException
- if a failure occurs constructing the Closurepublic ValueRepresentation 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 context
XPathException
- if evaluation of the expression failspublic StyleNodeFactory makeStyleNodeFactory()
public void setLazyConstructionMode(boolean lazy)
lazy
- true to switch lazy construction mode on, false to switch it off.public boolean isLazyConstructionMode()
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(String uri)
uri
- the identifying URI of the required external object model
public ExternalObjectModel getExternalObjectModel(Class nodeClass)
nodeClass
- the class of the Node object in the external object model
public List<ExternalObjectModel> getExternalObjectModels()
ExternalObjectModel
public NodeInfo unravel(Source source)
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.
IllegalArgumentException
- if the source object is not of a recognized class. This method does
to resolve the Source
.public void setDOMLevel(int level)
level
- the DOM level. Must be 2 or 3. By default Saxon assumes that DOM level 3 is available;
this parameter can be set to the value 2 to indicate that Saxon should not use methods unless they
are available in DOM level 2. From Saxon 9.2, this switch remains available, but the use of
DOM level 2 is untested and unsupported.public int getDOMLevel()
public StaticQueryContext newStaticQueryContext()
public PendingUpdateList newPendingUpdateList()
UnsupportedOperationException
- if called when using Saxon-Bpublic PipelineConfiguration makePipelineConfiguration()
public static Configuration getConfiguration(XPathContext context)
context
- the XPath dynamic context
public 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 Source resolveSource(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
recognized
XPathException
- if the Source object is recognized but cannot be processedpublic DocumentInfo buildDocument(Source source) throws XPathException
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 precendence 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.
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(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 nodepublic Receiver makeEmitter(String clarkName, 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 NodeInfo makeUnconstructedElement(ElementCreator instr, XPathContext context) throws XPathException
instr
- the instruction that creates the elementcontext
- the dynamic evaluation context
XPathException
- if an error occurs, for example
if called in Saxon-HEpublic NodeInfo makeUnconstructedDocument(DocumentInstr instr, XPathContext context) throws XPathException
instr
- the instruction that creates the document nodecontext
- the dynamic evaluation context
XPathException
- in Saxon-HEpublic void setConfigurationProperty(String name, Object value)
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".
IllegalArgumentException
- if the property name is not recognized or if the value is not
a valid value for the named propertyprotected boolean requireBoolean(String propertyName, 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)
IllegalArgumentException
- if the supplied value cannot be validated as a recognized boolean valueprotected String requireString(String propertyName, Object value)
protected Object instantiateClassName(String propertyName, Object value, Class requiredClass)
public Object getConfigurationProperty(String name)
name
- the name of the required property. See the class FeatureKeys
for
constants representing the property names that can be requested.
IllegalArgumentException
- thrown if the property is not one that Saxon recognizes.public void setDebugBytecode(boolean debugBytecode)
debugBytecode
- true to switch debugging onpublic boolean isDebugBytecode()
public void setDisplayBytecode(boolean displayBytecode)
displayBytecode
- true to switch debugging onpublic boolean isDisplayBytecode()
public void setGenerateByteCode(boolean compileToBytecode)
compileToBytecode
- true to switch the option onpublic boolean isGenerateByteCode(int hostLanguage)
hostLanguage
- one of XSLT or XQUERY
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |