Package net.sf.saxon
Interface Platform
-
- All Superinterfaces:
java.io.Serializable
- All Known Implementing Classes:
JavaPlatform
public interface Platform extends java.io.Serializable
This interface provides access to methods whose implementation depends on the chosen platform (typically Java or .NET)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addFunctionLibraries(FunctionLibraryList list, Configuration config, int hostLanguage)
Add the platform-specific function libraries to a function library list.boolean
canReturnCollationKeys(StringCollator collation)
Given a collation, determine whether it is capable of returning collation keys.RegularExpression
compileRegularExpression(java.lang.CharSequence regex, int xmlVersion, int syntax, java.lang.CharSequence flags)
Create a compiled regular expressionvoid
declareJavaClass(FunctionLibrary library, java.lang.String uri, java.lang.Class theClass)
Register a namespace-to-Java-class mapping declared using saxon:script in an XSLT stylesheetjava.lang.Object
getCollationKey(NamedCollation namedCollation, java.lang.String value)
Given a collation, get a collation key.SchemaType
getExternalObjectType(Configuration config, java.lang.String uri, java.lang.String localName)
Get a SchemaType representing a wrapped external (Java or .NET) objectjavax.xml.transform.Source
getParserSource(PipelineConfiguration pipe, javax.xml.transform.stream.StreamSource input, int validation, boolean dtdValidation, int stripspace)
Convert a StreamSource to either a SAXSource or a PullSource, depending on the native parser of the selected platformjava.lang.String
getPlatformSuffix()
Get a suffix letter to add to the Saxon version number to identify the platformjava.lang.String
getPlatformVersion()
Get the platform versionvoid
initialize(Configuration config)
Perform platform-specific initialization of the configurationboolean
isDotNet()
Return true if this is the .NET platformboolean
isJava()
Return true if this is the Java platformjava.net.URI
makeAbsolute(java.lang.String relativeURI, java.lang.String base)
Construct an absolute URI from a relative URI and a base URIStringCollator
makeCollation(Configuration config, java.util.Properties props, java.lang.String uri)
Obtain a collation with a given set of properties.void
makeExtensionLibrary(Configuration config)
Make the default extension function library (or libraries) appropriate to the platform, and register them with the Configuration.
-
-
-
Method Detail
-
initialize
void initialize(Configuration config)
Perform platform-specific initialization of the configuration- 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
-
makeAbsolute
java.net.URI makeAbsolute(java.lang.String relativeURI, java.lang.String base) throws java.net.URISyntaxException
Construct an absolute URI from a relative URI and a base URI- Parameters:
relativeURI
- the relative URI. Null is permitted provided that the base URI is an absolute URIbase
- the base URI- Returns:
- the absolutized URI
- Throws:
java.net.URISyntaxException
-
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
-
getParserSource
javax.xml.transform.Source getParserSource(PipelineConfiguration pipe, javax.xml.transform.stream.StreamSource input, int validation, boolean dtdValidation, int stripspace)
Convert a StreamSource to either a SAXSource or a PullSource, depending on the native parser of the selected platform- Parameters:
pipe
- the pipeline Configurationinput
- the supplied StreamSourcevalidation
- required validation mode, for example Validation.STRICTdtdValidation
- true if DTD-based input validation is requiredstripspace
- option for whitespace-stripping (ALL, NONE, or IGNORABLE)- Returns:
- the PullSource or SAXSource, initialized with a suitable parser, or the original input Source, if now special handling is required or possible
-
compileRegularExpression
RegularExpression compileRegularExpression(java.lang.CharSequence regex, int xmlVersion, int syntax, java.lang.CharSequence flags) throws XPathException
Create a compiled regular expression- Parameters:
regex
- the source text of the regular expression, in XML Schema or XPath syntaxxmlVersion
- version of XML in use (1.0 or 1.1)syntax
-flags
- the flags argument as supplied to functions such as fn:matches(), in string form @throws XPathException if the syntax of the regular expression or flags is incorrect @return the compiled regular expression- Throws:
XPathException
-
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=ed-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
java.lang.Object getCollationKey(NamedCollation 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)
-
makeExtensionLibrary
void makeExtensionLibrary(Configuration config)
Make the default extension function library (or libraries) appropriate to the platform, and register them with the Configuration. Note that this does not actually add the libraries to any library list.- Parameters:
config
- the Saxon Configuration
-
addFunctionLibraries
void addFunctionLibraries(FunctionLibraryList list, Configuration config, int hostLanguage)
Add the platform-specific function libraries to a function library list. The libraries that are added are those registered with the Configuration usingConfiguration.setExtensionBinder(String, net.sf.saxon.functions.FunctionLibrary)
- Parameters:
list
- the function library list that is to be extendedconfig
- the ConfigurationhostLanguage
- the host language (XSLT, XPath, XQuery)
-
declareJavaClass
void declareJavaClass(FunctionLibrary library, java.lang.String uri, java.lang.Class theClass)
Register a namespace-to-Java-class mapping declared using saxon:script in an XSLT stylesheet- Parameters:
library
- the library to contain the function, which must be a JavaExtensionLibraryuri
- the namespace of the function nametheClass
- the Java class that implements this namespace
-
getExternalObjectType
SchemaType 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
-
-