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

## net.sf.saxon.sxpath
Class AbstractStaticContext

    java.lang.Object
      net.sf.saxon.sxpath.AbstractStaticContext

All Implemented Interfaces:
  StaticContext

Direct Known Subclasses:
  IndependentContext, JAXPXPathStaticContext

    public abstract class AbstractStaticContext

extends Object
implements StaticContext

An abstract and configurable implementation of the StaticContext interface, which defines the static context of an XPath expression.

This class implements those parts of the functionality of a static context that tend to be common to most implementations: simple-valued properties such as base URI and default element namespace; availability of the standard function library; and support for collations.

Constructor Summary
`AbstractStaticContext()`

Method Summary
`void` | `declareCollation(String name, StringCollator comparator, boolean isDefault)` Declare a named collation
`String` | `getBaseURI()` Get the Base URI, for resolving any relative URI's used in the expression.
`StringCollator` | `getCollation(String name)` Get a named collation.
`int` | `getColumnNumber()` Return the character position where the current document event ends.
`Configuration` | `getConfiguration()` Get the system configuration
`String` | `getDefaultCollationName()` Get the name of the default collation.
`String` | `getDefaultElementNamespace()` Get the default XPath namespace URI Return NamespaceConstant.NULL for the non-namespace
`String` | `getDefaultFunctionNamespace()` Get the default function namespace
`Executable` | `getExecutable()` Get the Executable (representing a complete stylesheet or query)
`FunctionLibrary` | `getFunctionLibrary()` Get the function library containing all the in-scope functions available in this static context.
`int` | `getHostLanguage()` Get the host language (XSLT, XQuery, XPath) used to implement the code in this container
`int` | `getLineNumber()` Get the line number of the expression within that container.
`LocationMap` | `getLocationMap()` Get the location map.
`LocationProvider` | `getLocationProvider()` Get the LocationProvider allowing location identifiers to be resolved.
`NamePool` | `getNamePool()` Get the NamePool used for compiling expressions
`String` | `getPublicId()` Return the public identifier.
`String` | `getSystemId()` Get the system ID of the container of the expression.
`boolean` | `isAllowedBuiltInType(AtomicType type)` Determine whether a built-in type is available in this context.
`boolean` | `isInBackwardsCompatibleMode()` Determine whether Backwards Compatible Mode is used
`void` | `issueWarning(String s, SourceLocator locator)` Issue a compile-time warning.
`XPathContext` | `makeEarlyEvaluationContext()` Construct a dynamic context for early evaluation of constant subexpressions
`boolean` | `replaceSubExpression(Expression original, Expression replacement)` Replace one subexpression by a replacement subexpression
`void` | `setBackwardsCompatibilityMode(boolean compatible)` Set XPath 1.0 compatibility mode on or off (by default, it is false)
`void` | `setBaseURI(String baseURI)` Set the base URI in the static context
`void` | `setDefaultElementNamespace(String uri)` Set the default namespace for elements and types
`void` | `setDefaultFunctionNamespace(String uri)` Set the default function namespace
`void` | `setFunctionLibrary(FunctionLibrary lib)` Set the function library to be used
`void` | `setLocationMap(LocationMap locationMap)`

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

Methods inherited from interface net.sf.saxon.expr.StaticContext
`bindVariable, getImportedSchemaNamespaces, getNamespaceResolver, getURIForPrefix, isImportedSchema`

Constructor Detail

### AbstractStaticContext

    public AbstractStaticContext()

Method Detail

### getConfiguration

    public Configuration getConfiguration()

  Get the system configuration

  Specified by:
    `getConfiguration` in interface `StaticContext`

### getExecutable

    public Executable getExecutable()

  Get the Executable (representing a complete stylesheet or query)

### getHostLanguage

    public int getHostLanguage()

  Get the host language (XSLT, XQuery, XPath) used to implement the code in this container

  Returns:
    `Configuration.XPATH`

### makeEarlyEvaluationContext

    public XPathContext makeEarlyEvaluationContext()

  Construct a dynamic context for early evaluation of constant subexpressions

  Specified by:
    `makeEarlyEvaluationContext` in interface `StaticContext`

### getLocationMap

    public LocationMap getLocationMap()

  Description copied from interface: `StaticContext`
  Get the location map. This is a mapping from short location ids held with each expression or subexpression, to a fully-resolved location in a source stylesheet or query.

  Specified by:
    `getLocationMap` in interface `StaticContext`

### setLocationMap

    public void setLocationMap(LocationMap locationMap)

### setBaseURI

    public void setBaseURI(String baseURI)

  Set the base URI in the static context

### getBaseURI

    public String getBaseURI()

  Get the Base URI, for resolving any relative URI's used in the expression. Used by the document() function, resolve-uri(), etc.

  Specified by:
    `getBaseURI` in interface `StaticContext`
  Returns:
    "" if no base URI has been set

### getFunctionLibrary

    public FunctionLibrary getFunctionLibrary()

  Get the function library containing all the in-scope functions available in this static context. This method is called by the XPath parser when binding a function call in the XPath expression to an implementation of the function.

  Specified by:
    `getFunctionLibrary` in interface `StaticContext`

### setFunctionLibrary

    public void setFunctionLibrary(FunctionLibrary lib)

  Set the function library to be used

### declareCollation

    public void declareCollation(String name,
                                 StringCollator comparator,
                                 boolean isDefault)

  Declare a named collation

  Parameters:
    `name` - The name of the collation (technically, a URI)
    `comparator` - The StringCollator used to implement the collating sequence
    `isDefault` - True if this is to be used as the default collation

### getCollation

    public StringCollator getCollation(String name)

  Get a named collation.

  Specified by:
    `getCollation` in interface `StaticContext`
  Parameters:
    `name` - The name of the required collation. Supply null to get the default collation.
  Returns:
    the collation identified by the given name, as set previously using declareCollation. Return null if no collation with this name is found.

### getDefaultCollationName

    public String getDefaultCollationName()

  Get the name of the default collation.

  Specified by:
    `getDefaultCollationName` in interface `StaticContext`
  Returns:
    the name of the default collation; or the name of the codepoint collation if no default collation has been defined

### getNamePool

    public NamePool getNamePool()

  Get the NamePool used for compiling expressions

  Specified by:
    `getNamePool` in interface `StaticContext`

### issueWarning

    public void issueWarning(String s,
                             SourceLocator locator)

  Issue a compile-time warning. This method is used during XPath expression compilation to output warning conditions. The default implementation writes the message to System.err. To change the destination of messages, create a subclass of StandaloneContext that overrides this method.

  Specified by:
    `issueWarning` in interface `StaticContext`

### getSystemId

    public String getSystemId()

  Get the system ID of the container of the expression. Used to construct error messages.

  Specified by:
    `getSystemId` in interface `StaticContext`
  Returns:
    "" always

### getLineNumber

    public int getLineNumber()

  Get the line number of the expression within that container. Used to construct error messages.

  Specified by:
    `getLineNumber` in interface `StaticContext`
  Returns:
    -1 always

### getDefaultElementNamespace

    public String getDefaultElementNamespace()

  Get the default XPath namespace URI Return NamespaceConstant.NULL for the non-namespace

  Specified by:
    `getDefaultElementNamespace` in interface `StaticContext`

### setDefaultElementNamespace

    public void setDefaultElementNamespace(String uri)

  Set the default namespace for elements and types

### setDefaultFunctionNamespace

    public void setDefaultFunctionNamespace(String uri)

  Set the default function namespace

### getDefaultFunctionNamespace

    public String getDefaultFunctionNamespace()

  Get the default function namespace

  Specified by:
    `getDefaultFunctionNamespace` in interface `StaticContext`

### setBackwardsCompatibilityMode

    public void setBackwardsCompatibilityMode(boolean compatible)

  Set XPath 1.0 compatibility mode on or off (by default, it is false)

  Parameters:
    `compatible` - true if XPath 1.0 compatibility mode is to be set to true, false if it is to be set to false.

### isInBackwardsCompatibleMode

    public boolean isInBackwardsCompatibleMode()

  Determine whether Backwards Compatible Mode is used

  Specified by:
    `isInBackwardsCompatibleMode` in interface `StaticContext`
  Returns:
    true if XPath 1.0 backwards compatibility has been selected (by default, it is false)

### isAllowedBuiltInType

    public boolean isAllowedBuiltInType(AtomicType type)

  Determine whether a built-in type is available in this context. This method caters for differences between host languages as to which set of types are built in.

  Specified by:
    `isAllowedBuiltInType` in interface `StaticContext`
  Parameters:
    `type` - the supposedly built-in type. This will always be a type in the XS namespace.
  Returns:
    true if this type can be used in this static context

### getLocationProvider

    public LocationProvider getLocationProvider()

  Get the LocationProvider allowing location identifiers to be resolved.

### replaceSubExpression

    public boolean replaceSubExpression(Expression original,
                                        Expression replacement)

  Replace one subexpression by a replacement subexpression

  Parameters:
    `original` - the original subexpression
    `replacement` - the replacement subexpression
  Returns:
    true if the original subexpression was found
  Throws:
    `UnsupportedOperationException` - (always)

### getPublicId

    public String getPublicId()

  Return the public identifier.

  The return value is the public identifier of the document entity or of the external parsed entity in which the markup that triggered the event appears.

  Returns:
    null (always).
  See Also:
    `getSystemId()`

### getColumnNumber

    public int getColumnNumber()

  Return the character position where the current document event ends.

  Returns:
    -1 (no column number is available).
  See Also:
    `getLineNumber()`

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

Copyright (C) Michael H. Kay. All rights reserved.