Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sf.saxon
Class JavaPlatform

    java.lang.Object
      net.sf.saxon.JavaPlatform

All Implemented Interfaces:
  Platform, java.io.Serializable

public class JavaPlatform
extends java.lang.Object
implements Platform

Implementation of the Platform class containing methods specific to the Java platform (as distinct from .NET)

See Also:
  Serialized Form

Method Summary
`boolean` | `canReturnCollationKeys(java.util.Comparator collation)` Given a collation, determine whether it is capable of returning collation keys.
`net.sf.saxon.regex.RegularExpression` | `compileRegularExpression(java.lang.CharSequence regex, boolean isXPath, java.lang.CharSequence flags)` Create a compiled regular expression
`static java.lang.String` | `escapeSpaces(java.lang.String s)` Replace spaces by %20
`java.lang.Object` | `getCollationKey(java.util.Comparator collation, java.lang.String value)` Given a collation, get a collation key.
`static JavaPlatform` | `getInstance()`
`javax.xml.transform.Source` | `getParserSource(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
`void` | `initialize(Configuration config)` Perform platform-specific initialization of the configuration
`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.util.Comparator` | `makeCollation(Configuration config, java.util.Properties props)` Obtain a collation with a given set of properties.
`static java.lang.String` | `tryToExpand(java.lang.String systemId)` If a system ID can't be parsed as a URL, we'll try to expand it as a relative URI using the current directory as the base URI: MHK addition.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### getInstance

    public static JavaPlatform getInstance()

### initialize

    public void initialize(Configuration config)

  Perform platform-specific initialization of the configuration

  Specified by:
    `initialize` in interface `Platform`

### makeAbsolute

    public 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

  Specified by:
    `makeAbsolute` in interface `Platform`
  Parameters:
    `relativeURI` - the relative URI
    `base` - the base URI
  Returns:
    the absolutized URI
  Throws:
    `java.net.URISyntaxException`

### escapeSpaces

    public static java.lang.String escapeSpaces(java.lang.String s)

  Replace spaces by %20

### tryToExpand

    public static java.lang.String tryToExpand(java.lang.String systemId)

  If a system ID can't be parsed as a URL, we'll try to expand it as a relative URI using the current directory as the base URI: MHK addition.

### getPlatformVersion

    public java.lang.String getPlatformVersion()

  Get the platform version

  Specified by:
    `getPlatformVersion` in interface `Platform`

### 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`

### getParserSource

    public javax.xml.transform.Source getParserSource(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:
    `input` - the supplied StreamSource
    `validation` -
    `dtdValidation` -
    `stripspace` -
  Returns:
    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.

### compileRegularExpression

    public net.sf.saxon.regex.RegularExpression compileRegularExpression(java.lang.CharSequence regex,
                                                                         boolean isXPath,
                                                                         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
    `isXPath` - set to true if this is an XPath regular expression, false if it is XML Schema
    `flags` - the flags argument as supplied to functions such as fn:matches(), in string form
  Returns:
    the compiled regular expression
  Throws:
    `XPathException` - if the syntax of the regular expression or flags is incorrect

### makeCollation

    public java.util.Comparator makeCollation(Configuration config,
                                              java.util.Properties props)
                                       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
  Returns:
    a collation with these properties
  Throws:
    `XPathException` - if a fatal error occurs

### canReturnCollationKeys

    public boolean canReturnCollationKeys(java.util.Comparator 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(java.util.Comparator collation,
                                            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 compare correctly under the compareTo method.

  Specified by:
    `getCollationKey` in interface `Platform`
  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)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD