Package net.sf.saxon
Interface Platform
-
- All Known Implementing Classes:
JavaPlatform,JavaPlatformEE,JavaPlatformPE
public interface PlatformThis interface provides access to methods whose implementation depends on the chosen platform (typically Java or .NET)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description booleancanReturnCollationKeys(StringCollator collation)Given a collation, determine whether it is capable of returning collation keys.RegularExpressioncompileRegularExpression(Configuration config, UnicodeString regex, java.lang.String flags, java.lang.String hostLanguage, java.util.List<java.lang.String> warnings)Compile a regular expressionAtomicMatchKeygetCollationKey(SimpleCollation namedCollation, java.lang.String value)Given a collation, get a collation key.java.lang.StringgetDefaultCountry()Get the default country for localization.IDynamicLoadergetDefaultDynamicLoader()Get the default DynamicLoader for the platformjava.lang.StringgetDefaultLanguage()Get the default language for localization.ExternalObjectTypegetExternalObjectType(Configuration config, java.lang.String uri, java.lang.String localName)Get a SchemaType representing a wrapped external (Java or .NET) objectjava.lang.StringgetInstallationDirectory(java.lang.String edition, Configuration config)Return the name of the directory in which the software is installed (if available)java.lang.StringgetPlatformSuffix()Get a suffix letter to add to the Saxon version number to identify the platformjava.lang.StringgetPlatformVersion()Get the platform versionbooleanhasICUCollator()Indicate whether the ICU library is available and supports CollationsbooleanhasICUNumberer()Indicate whether the ICU library is available and supports Numberersvoidinitialize(Configuration config)Perform platform-specific initialization of the configuration.booleanisDotNet()Return true if this is the .NET platformbooleanisJava()Return true if this is the Java platformbooleanJAXPStaticContextCheck(RetainedStaticContext retainedStaticContext, StaticContext sc)Checks if the supplied static context is an instance of the JAXP static context.org.xml.sax.XMLReaderloadParser()Get a parser by instantiating the SAXParserFactoryorg.xml.sax.XMLReaderloadParserForXmlFragments()Get an XML parser suitable for use for reading XML fragments.java.io.InputStreamlocateResource(java.lang.String filename, java.util.List<java.lang.String> messages)Read a resource file issued with the Saxon productStringCollatormakeCollation(Configuration config, java.util.Properties props, java.lang.String uri)Obtain a collation with a given set of properties.java.lang.ClassLoadermakeGeneratedClassLoader(Configuration config, java.lang.Class<?> thisClass)Return the class loader required to load the bytecode generated classesModuleURIResolvermakeStandardModuleURIResolver(Configuration config)Make an instance of the default module URI resolver for this platformStringCollatormakeUcaCollator(java.lang.String uri, Configuration config)If available, make a UCA collation.voidregisterAllBuiltInObjectModels(Configuration config)Register all the external object models that are provided as standard with the relevant edition of Saxon for this ConfigurationActiveSourceresolveSource(javax.xml.transform.Source source, Configuration config)Convert a Source to an ActiveSource.voidsetDefaultSAXParserFactory(Configuration config)Set the default XML parser to be loaded by the SAXParserFactory on this platform.default voidshowEmbeddedResources()Diagnostic method to list the embedded resources contained in the loaded software
-
-
-
Method Detail
-
initialize
void initialize(Configuration config)
Perform platform-specific initialization of the configuration. Note that this should not undo any configuration settings defined in the configuration file.- Parameters:
config- the Saxon Configuration
-
isJava
boolean isJava()
Return true if this is the Java platform- Returns:
- true if this is the Java platform
-
isDotNet
boolean isDotNet()
Return true if this is the .NET platform- Returns:
- true if this is the .NET platform
-
getPlatformVersion
java.lang.String getPlatformVersion()
Get the platform version- Returns:
- the version of the platform, for example "Java version 1.5.09"
-
getPlatformSuffix
java.lang.String getPlatformSuffix()
Get a suffix letter to add to the Saxon version number to identify the platform- Returns:
- "J" for Java, "N" for .NET, "CS" for SaxonCS
-
getDefaultDynamicLoader
IDynamicLoader getDefaultDynamicLoader()
Get the default DynamicLoader for the platform- Returns:
- the default DynamicLoader
-
getDefaultLanguage
java.lang.String getDefaultLanguage()
Get the default language for localization.- Returns:
- the default language
-
getDefaultCountry
java.lang.String getDefaultCountry()
Get the default country for localization.- Returns:
- the default country
-
locateResource
java.io.InputStream locateResource(java.lang.String filename, java.util.List<java.lang.String> messages)Read a resource file issued with the Saxon product- Parameters:
filename- the filename of the file to be readmessages- List to be populated with messages in the event of failure- Returns:
- an InputStream for reading the file/resource
-
showEmbeddedResources
default void showEmbeddedResources()
Diagnostic method to list the embedded resources contained in the loaded software
-
loadParser
org.xml.sax.XMLReader loadParser()
Get a parser by instantiating the SAXParserFactory- Returns:
- the parser (XMLReader)
-
loadParserForXmlFragments
org.xml.sax.XMLReader loadParserForXmlFragments()
Get an XML parser suitable for use for reading XML fragments. This may differ from the parser used for reading complete XML documents, because some parsers may lack the capability to read fragments. See bug 4253.- Returns:
- the parser (XMLReader)
-
resolveSource
ActiveSource resolveSource(javax.xml.transform.Source source, Configuration config) throws XPathException
Convert a Source to an ActiveSource. This method is present in the Platform because different Platforms accept different kinds of Source object.- Parameters:
source- A source object, typically the source supplied as the first argument toTransformer.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.- Returns:
- a source object that Saxon knows how to process. This must be an instance of one
of the classes StreamSource, SAXSource, DOMSource,
AugmentedSource,NodeInfo, orPullSource. Return null if the Source object is not recognized - Throws:
XPathException- if the Source object is recognized but cannot be processed
-
makeCollation
StringCollator makeCollation(Configuration config, java.util.Properties props, java.lang.String uri) throws XPathException
Obtain a collation with a given set of properties. The set of properties is extensible and variable across platforms. Common properties with example values include lang=en-GB, strength=primary, case-order=upper-first, ignore-modifiers=yes, alphanumeric=yes. Properties that are not supported are generally ignored; however some errors, such as failing to load a requested class, are fatal.- Parameters:
config- the configuration objectprops- the desired properties of the collationuri- the collation URI- Returns:
- a collation with these properties
- Throws:
XPathException- if a fatal error occurs
-
canReturnCollationKeys
boolean canReturnCollationKeys(StringCollator collation)
Given a collation, determine whether it is capable of returning collation keys. The essential property of collation keys is that if two values are equal under the collation, then the collation keys are equal under the equals() method.- Parameters:
collation- the collation being examined, provided as a Comparator- Returns:
- true if this collation can supply collation keys
-
getCollationKey
AtomicMatchKey getCollationKey(SimpleCollation namedCollation, java.lang.String value)
Given a collation, get a collation key. The essential property of collation keys is that if two values are equal under the collation, then the collation keys are equal under the equals() method.- Parameters:
namedCollation- the collation in usevalue- the string whose collation key is required- Returns:
- a representation of the collation key, such that two collation keys are equal() if and only if the string values they represent are equal under the specified collation.
- Throws:
java.lang.ClassCastException- if the collation is not one that is capable of supplying collation keys (this should have been checked in advance)
-
hasICUCollator
boolean hasICUCollator()
Indicate whether the ICU library is available and supports Collations- Returns:
- true if the ICU library class for collations appears to be loaded
-
hasICUNumberer
boolean hasICUNumberer()
Indicate whether the ICU library is available and supports Numberers- Returns:
- true if the ICU library class for rule-based numbering appears to be loaded
-
makeUcaCollator
StringCollator makeUcaCollator(java.lang.String uri, Configuration config) throws XPathException
If available, make a UCA collation. Depending on the Saxon edition and licensing, this will use the ICU-J Library if available, or the built-in Java collation support otherwise.- Parameters:
uri- the collation URI (which will always be a UCA collation URI as defined in XSLT 3.0)config- the Saxon configuration- Returns:
- the collation, or null if not available
- Throws:
XPathException- if the URI is malformed in some way
-
compileRegularExpression
RegularExpression compileRegularExpression(Configuration config, UnicodeString regex, java.lang.String flags, java.lang.String hostLanguage, java.util.List<java.lang.String> warnings) throws XPathException
Compile a regular expression- Parameters:
config- the Saxon configurationregex- 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.- Returns:
- the compiled regular expression
- Throws:
XPathException- if the regular expression or the flags are invalid
-
getExternalObjectType
ExternalObjectType getExternalObjectType(Configuration config, java.lang.String uri, java.lang.String localName)
Get a SchemaType representing a wrapped external (Java or .NET) object- Parameters:
config- the Saxon Configurationuri- the namespace URI of the schema typelocalName- the local name of the schema type- Returns:
- the SchemaType object representing this type
-
getInstallationDirectory
java.lang.String getInstallationDirectory(java.lang.String edition, Configuration config)Return the name of the directory in which the software is installed (if available)- Parameters:
edition- The edition of the software that is loaded ("HE", "PE", or "EE")config- the Saxon configuration- Returns:
- the name of the directory in which Saxon is installed, if available, or null otherwise
-
registerAllBuiltInObjectModels
void registerAllBuiltInObjectModels(Configuration config)
Register all the external object models that are provided as standard with the relevant edition of Saxon for this Configuration- Parameters:
config- the Saxon configuration- Since:
- 9.3
-
setDefaultSAXParserFactory
void setDefaultSAXParserFactory(Configuration config)
Set the default XML parser to be loaded by the SAXParserFactory on this platform. Needed because the Apache catalog resolver uses the SAXParserFactory to instantiate a parser, and if not customized this causes a failure on the .NET platform.- Parameters:
config- the Saxon configuration- Since:
- 9.4
-
JAXPStaticContextCheck
boolean JAXPStaticContextCheck(RetainedStaticContext retainedStaticContext, StaticContext sc)
Checks if the supplied static context is an instance of the JAXP static context. On Java we create namespace information from the JAXP XPath static context. On the .NET platform we do nothing.- Parameters:
retainedStaticContext- If the static context is a JAXPStaticContext, then its namespaces are used to update the retainedStaticContextsc- the possible JAXPStaticContext- Returns:
- boolean
- Since:
- 9.7.0.5
-
makeStandardModuleURIResolver
ModuleURIResolver makeStandardModuleURIResolver(Configuration config)
Make an instance of the default module URI resolver for this platform- Parameters:
config- the Saxon configuration- Returns:
- an instance of ModuleURIResolver
- Since:
- 9.7.0.2
-
makeGeneratedClassLoader
java.lang.ClassLoader makeGeneratedClassLoader(Configuration config, java.lang.Class<?> thisClass)
Return the class loader required to load the bytecode generated classes- Parameters:
config- The saxon configurationthisClass- The class object generated- Returns:
- the class loader object
- Since:
- 9.6.0.3
-
-