net.sf.saxon.dotnet
Class DotNetPlatform

java.lang.Object
  extended by net.sf.saxon.dotnet.DotNetPlatform
All Implemented Interfaces:
java.io.Serializable, Platform

public class DotNetPlatform
extends java.lang.Object
implements Platform

Implementation of the Platform interface containing methods appropriate to the .NET platform

See Also:
Serialized Form

Method Summary
 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 expression
 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
 cli.System.Type dynamicLoad(java.lang.String uri, java.lang.String baseURI, boolean debug)
          Dynamically load a .NET class with a given name, starting with a URI that contains information about the type and the assembly
 java.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) object
static DotNetPlatform getInstance()
          Get the singular instance of this class
 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
 java.lang.String getPlatformSuffix()
          Get a suffix letter to add to the Saxon version number to identify the platform
 java.lang.String getPlatformVersion()
          Get the platform version
static java.lang.String getSaxonSaFullyQualifiedClassName()
          Get the fully qualified class name of the Saxon-SA Configuration class
 void initialize(Configuration config)
          Perform platform-specific initialization of the configuration
 boolean isDotNet()
          Return true if this is the .NET platform
 boolean isJava()
          Return true if this is the Java platform
 java.net.URI makeAbsolute(java.lang.String relativeURI, java.lang.String base)
          Construct an absolute URI from a relative URI and a base URI
 java.net.URI makeAbsoluteOLD(java.lang.String relativeURI, java.lang.String base)
          Construct an absolute URI from a relative URI and a base URI
 StringCollator 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 factory appropriate to the platform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static DotNetPlatform getInstance()
Get the singular instance of this class

Returns:
the singular DotNetPlatform

getSaxonSaFullyQualifiedClassName

public static java.lang.String getSaxonSaFullyQualifiedClassName()
Get the fully qualified class name of the Saxon-SA Configuration class

Returns:
the fully-qualified class name

initialize

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

Specified by:
initialize in interface Platform
Parameters:
config - the Saxon Configuration

isJava

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

Specified by:
isJava in interface Platform
Returns:
true if this is the Java platform

isDotNet

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

Specified by:
isDotNet in interface Platform
Returns:
true if this is the .NET platform

makeAbsoluteOLD

public java.net.URI makeAbsoluteOLD(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
base - the base URI
Returns:
the absolutized URI
Throws:
java.net.URISyntaxException

makeAbsolute

public java.net.URI makeAbsolute(java.lang.String relativeURI,
                                 java.lang.String base)
                          throws java.net.URISyntaxException
Description copied from interface: Platform
Construct an absolute URI from a relative URI and a base URI

Specified by:
makeAbsolute in interface Platform
Parameters:
relativeURI - the relative URI. Null is permitted provided that the base URI is an absolute URI
base - the base URI
Returns:
the absolutized URI
Throws:
java.net.URISyntaxException

getPlatformVersion

public java.lang.String getPlatformVersion()
Get the platform version

Specified by:
getPlatformVersion in interface Platform
Returns:
the version of the platform, for example "Java version 1.5.09"

getPlatformSuffix

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

Specified by:
getPlatformSuffix in interface Platform
Returns:
"J" for Java, "N" for .NET

getParserSource

public 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

Specified by:
getParserSource in interface Platform
Parameters:
pipe - the pipeline configuration
input - the supplied StreamSource
validation - indicates whether schema validation is required, adn in what mode
dtdValidation - true if DTD validation is required
stripspace - defines the requird whitespace handling
Returns:
the PullSource or SAXSource, initialized with a suitable parser, or the original input Source, if now special handling is required or possible. May also return an AugmentedSource that wraps one of these.

compileRegularExpression

public RegularExpression compileRegularExpression(java.lang.CharSequence regex,
                                                  int xmlVersion,
                                                  int syntax,
                                                  java.lang.CharSequence flags)
                                           throws XPathException
Create a compiled regular expression

Specified by:
compileRegularExpression in interface Platform
Parameters:
regex - the source text of the regular expression, in XML Schema or XPath syntax
xmlVersion - One of Configuration.XML10 or Configuration.XML11
syntax - one of XPath, XMLSchema, or native, indicating the regular expression syntax used
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

public 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.

Specified by:
makeCollation in interface Platform
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

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.

Specified by:
canReturnCollationKeys in interface Platform
Parameters:
collation - the collation, provided as a Comparator
Returns:
true if this collation can supply collation keys

getCollationKey

public 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.

Specified by:
getCollationKey in interface Platform
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:
java.lang.ClassCastException - if the collation is not one that is capable of supplying collation keys (this should have been checked in advance)

makeExtensionLibrary

public void makeExtensionLibrary(Configuration config)
Make the default extension function factory appropriate to the platform

Specified by:
makeExtensionLibrary in interface Platform
Parameters:
config - the Saxon Configuration

addFunctionLibraries

public 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 using Configuration.setExtensionBinder(String, net.sf.saxon.functions.FunctionLibrary)

Specified by:
addFunctionLibraries in interface Platform
Parameters:
list - the function library list that is to be extended
config - the Configuration
hostLanguage - the host language (XSLT, XPath, XQuery)

declareJavaClass

public void declareJavaClass(FunctionLibrary library,
                             java.lang.String uri,
                             java.lang.Class theClass)
Description copied from interface: Platform
Register a namespace-to-Java-class mapping declared using saxon:script in an XSLT stylesheet

Specified by:
declareJavaClass in interface Platform
Parameters:
library - the library to contain the function, which must be a JavaExtensionLibrary
uri - the namespace of the function name
theClass - the Java class that implements this namespace

dynamicLoad

public cli.System.Type dynamicLoad(java.lang.String uri,
                                   java.lang.String baseURI,
                                   boolean debug)
                            throws XPathException
Dynamically load a .NET class with a given name, starting with a URI that contains information about the type and the assembly

Parameters:
uri - A URI in the form clitype:Full.Type.Name?param=value;

Query parameters in the URL may be separated by semicolons or ampersands. The recognized parameters are:

  • asm - the name of the assembly
  • ver - the version of the assembly
  • loc - the culture
  • sn - the strong name
  • from - the location to load from
  • partialname - the partial name of the assembly
baseURI - base URI of the expression containing an extension function call (null if not known). This is used to resolve any relative URI appearing in the "from" parameter of the query part of the namespace URI
debug - true if diagnostic tracing is enabled @return the cli.System.Type object representing the dynamically loaded class
Returns:
the successfully loaded Type
Throws:
XPathException

getExternalObjectType

public SchemaType getExternalObjectType(Configuration config,
                                        java.lang.String uri,
                                        java.lang.String localName)
Description copied from interface: Platform
Get a SchemaType representing a wrapped external (Java or .NET) object

Specified by:
getExternalObjectType in interface Platform
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