net.sf.saxon

Interface Platform

public interface Platform extends Serializable

This interface provides access to methods whose implementation depends on the chosen platform (typically Java or .NET)
Method Summary
booleancanReturnCollationKeys(StringCollator collation)
Given a collation, determine whether it is capable of returning collation keys.
ObjectgetCollationKey(NamedCollation namedCollation, String value)
Given a collation, get a collation key.
SchemaTypegetExternalObjectType(Configuration config, String uri, String localName)
Get a SchemaType representing a wrapped external (Java or .NET) object
SourcegetParserSource(PipelineConfiguration pipe, 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
StringgetPlatformSuffix()
Get a suffix letter to add to the Saxon version number to identify the platform
StringgetPlatformVersion()
Get the platform version
StringgetVerifierClassName()
Get the verifier class name appropriate to the platform
voidinitialize(Configuration config)
Perform platform-specific initialization of the configuration
booleanisDotNet()
Return true if this is the .NET platform
booleanisJava()
Return true if this is the Java platform
XMLReaderloadParser()
Get a parser by instantiating the SAXParserFactory
StringCollatormakeCollation(Configuration config, Properties props, String uri)
Obtain a collation with a given set of properties.

Method Detail

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.

Parameters: collation the collation being examined, provided as a Comparator

Returns: true if this collation can supply collation keys

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 equal under the equals() method.

Parameters: namedCollation the collation in use value 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: ClassCastException if the collation is not one that is capable of supplying collation keys (this should have been checked in advance)

getExternalObjectType

public SchemaType getExternalObjectType(Configuration config, String uri, String localName)
Get a SchemaType representing a wrapped external (Java or .NET) object

Parameters: config the Saxon Configuration uri the namespace URI of the schema type localName the local name of the schema type

Returns: the SchemaType object representing this type

getParserSource

public Source getParserSource(PipelineConfiguration pipe, 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 Configuration input the supplied StreamSource validation required validation mode, for example Validation.STRICT dtdValidation true if DTD-based input validation is required stripspace 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

getPlatformSuffix

public String getPlatformSuffix()
Get a suffix letter to add to the Saxon version number to identify the platform

Returns: "J" for Java, "N" for .NET

getPlatformVersion

public String getPlatformVersion()
Get the platform version

Returns: the version of the platform, for example "Java version 1.5.09"

getVerifierClassName

public String getVerifierClassName()
Get the verifier class name appropriate to the platform

initialize

public void initialize(Configuration config)
Perform platform-specific initialization of the configuration

Parameters: config the Saxon Configuration

isDotNet

public boolean isDotNet()
Return true if this is the .NET platform

Returns: true if this is the .NET platform

isJava

public boolean isJava()
Return true if this is the Java platform

Returns: true if this is the Java platform

loadParser

public XMLReader loadParser()
Get a parser by instantiating the SAXParserFactory

Returns: the parser (XMLReader)

makeCollation

public StringCollator makeCollation(Configuration config, Properties props, String uri)
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 object props the desired properties of the collation uri the collation URI

Returns: a collation with these properties

Throws: XPathException if a fatal error occurs