Implementation of the Platform class containing methods specific to the Java platform
(as distinct from .NET). This is a singleton class with no instance data.
canReturnCollationKeys
public 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.
- canReturnCollationKeys in interface Platform
collation
- the collation, provided as a Comparator
- true if this collation can supply collation keys
compileRegularExpression
public RegularExpression compileRegularExpression(CharSequence regex,
int xmlVersion,
int syntax,
CharSequence flags)
throws XPathException
Create a compiled regular expression
- compileRegularExpression in interface Platform
regex
- the source text of the regular expression, in XML Schema or XPath syntaxxmlVersion
- set to integer 10 for XML 1.0, 11 for XML 1.1syntax
- 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
declareJavaClass
public void declareJavaClass(FunctionLibrary library,
String uri,
Class theClass)
Register a namespace-to-Java-class mapping declared using saxon:script in an XSLT stylesheet
- declareJavaClass in interface Platform
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
getCollationKey
public Object getCollationKey(NamedCollation namedCollation,
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
compare correctly under the equals() method.
- getCollationKey in interface Platform
getParserSource
public Source getParserSource(Configuration config,
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
- getParserSource in interface Platform
config
- input
- the supplied StreamSourcevalidation
- dtdValidation
- stripspace
-
- the PullSource or SAXSource, initialized with a suitable parser, or the original
input Source, if now special handling is required or possible. This implementation
always returns the original input unchanged.
getPlatformSuffix
public String getPlatformSuffix()
Get a suffix letter to add to the Saxon version number to identify the platform
- getPlatformSuffix in interface Platform
isDotNet
public boolean isDotNet()
Return true if this is the .NET platform
- isDotNet in interface Platform
isJava
public boolean isJava()
Return true if this is the Java platform
- isJava in interface Platform
makeAbsolute
public URI makeAbsolute(String relativeURI,
String base)
throws URISyntaxException
Construct an absolute URI from a relative URI and a base URI. The method uses the resolve
method of the java.net.URI class, except where the base URI uses the (non-standard) "jar:" scheme,
in which case the method used is
new URL(baseURL, relativeURL)
.
Spaces in either URI are converted to %20
If no base URI is available, and the relative URI is not an absolute URI, then the current
directory is used as a base URI.
- makeAbsolute in interface Platform
relativeURI
- the relative URI. Null is permitted provided that the base URI is an absolute URIbase
- the base URI
makeCollation
public StringCollator makeCollation(Configuration config,
Properties props,
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.
- makeCollation in interface Platform
config
- the configuration objectprops
- the desired properties of the collationuri
-
- a collation with these properties