net.sf.saxon.xpath
public class StandaloneContext extends Object implements StaticContext, NamespaceResolver
Constructor Summary | |
---|---|
StandaloneContext()
Create a StandaloneContext using the default Configuration and NamePool | |
StandaloneContext(Configuration config)
Create a StandaloneContext using a specific Configuration. | |
StandaloneContext(NodeInfo node)
Create a StandaloneContext using a specific Node. |
Method Summary | |
---|---|
VariableReference | bindVariable(int fingerprint)
Bind a variable used in an XPath Expression to the XSLVariable element in which it is declared.
|
void | clearAllNamespaces()
Clear all the declared namespaces, including the standard ones (xml, xslt, saxon).
|
void | clearNamespaces()
Clear all the declared namespaces, except for the standard ones (xml, xslt, saxon, xdt).
|
void | declareCollation(String name, Comparator comparator, boolean isDefault)
Declare a named collation |
void | declareNamespace(String prefix, String uri)
Declare a namespace whose prefix can be used in expressions. |
Variable | declareVariable(String qname, Object initialValue)
Declare a variable. |
String | getBaseURI()
Get the Base URI of the stylesheet element, for resolving any relative URI's used
in the expression.
|
Comparator | getCollation(String name)
Get a named collation. |
Configuration | getConfiguration()
Get the system configuration |
String | getDefaultCollationName()
Get the name of the default collation. |
short | getDefaultElementNamespace()
Get the default XPath namespace, as a namespace code that can be looked up in the NamePool |
String | getDefaultFunctionNamespace()
Get the default function namespace |
FunctionLibrary | getFunctionLibrary()
Get the function library containing all the in-scope functions available in this static
context |
Set | getImportedSchemaNamespaces()
Get the set of imported schemas
|
int | getLineNumber()
Get the line number of the expression within that container.
|
LocationMap | getLocationMap() |
NamePool | getNamePool()
Get the NamePool used for compiling expressions |
NamespaceContext | getNamespaceContext()
Get the NamespaceContext that was set using |
NamespaceResolver | getNamespaceResolver() |
SlotManager | getStackFrameMap()
Get the stack frame map containing the slot number allocations for the variables declared
in this static context |
String | getSystemId()
Get the system ID of the container of the expression. |
String | getURIForPrefix(String prefix)
Get the URI for a prefix, using the declared namespaces as
the context for namespace resolution. |
String | getURIForPrefix(String prefix, boolean useDefault)
Get the namespace URI corresponding to a given prefix. |
XPathFunctionResolver | getXPathFunctionResolver() |
XPathVariableResolver | getXPathVariableResolver()
Get the XPathVariableResolver |
void | importSchema(Source source)
Import a schema. |
boolean | isAllowedBuiltInType(AtomicType type)
Determine whether a built-in type is available in this context. |
boolean | isImportedSchema(String namespace)
Determine whether a Schema for a given target namespace has been imported. |
boolean | isInBackwardsCompatibleMode()
Determine whether Backwards Compatible Mode is used |
void | issueWarning(String s, SourceLocator locator)
Issue a compile-time warning. |
Iterator | iteratePrefixes()
Get an iterator over all the prefixes declared in this namespace context. |
XPathContext | makeEarlyEvaluationContext()
Construct a dynamic context for early evaluation of constant subexpressions |
void | setBackwardsCompatibilityMode(boolean backwardsCompatible)
Set XPath 1.0 backwards compatibility mode |
void | setBaseURI(String baseURI)
Set the base URI in the static context |
void | setDefaultElementNamespace(String uri)
Set the default namespace for element and type names |
void | setDefaultFunctionNamespace(String uri)
Set the default function namespace |
void | setFunctionLibrary(FunctionLibrary lib)
Set the function library to be used |
void | setLocationMap(LocationMap locationMap) |
void | setNamespaceContext(NamespaceContext context)
Supply the NamespaceContext used to resolve namespaces. |
void | setNamespaces(NodeInfo node)
Set all the declared namespaces to be the namespaces that are in-scope for a given node.
|
void | setXPathFunctionResolver(XPathFunctionResolver xPathFunctionResolver) |
void | setXPathVariableResolver(XPathVariableResolver resolver)
Set an XPathVariableResolver. |
Parameters: config the Configuration. For schema-aware XPath expressions, this must be a SchemaAwareConfiguration.
If the variable has been explicitly declared using StandaloneContext, that value is used; otherwise if a variable resolved has been supplied using setXPathVariableResolver then that is used.
Throws: StaticError If no variable with the given name is found, or if the value supplied for the variable cannot be converted to an XPath value.
Parameters: name The name of the collation (technically, a URI) comparator The Java Comparator used to implement the collating sequence isDefault True if this is to be used as the default collation
Parameters: prefix The namespace prefix. Must not be null. Must not be the empty string ("") - unqualified names in an XPath expression always refer to the null namespace. uri The namespace URI. Must not be null.
Parameters: qname Lexical QName identifying the variable. The namespace prefix, if any, must have been declared before this method is called, or must be resolvable using the namespace context. initialValue The initial value of the variable. A Java object that can be converted to an XPath value.
Returns: "" if no base URI has been set
Returns: the collation identified by the given name, as set previously using declareCollation. Return null if no collation with this name is found.
Returns: the name of the default collation; or the name of the codepoint collation if no default collation has been defined
Returns: a Set, the set of URIs representing the names of imported schemas
Returns: -1 always
Returns: "" always
Parameters: prefix The prefix
Throws: net.sf.saxon.trans.XPathException if the prefix is not declared
Parameters: prefix the namespace prefix useDefault true if the default namespace is to be used when the prefix is ""
Returns: the uri for the namespace, or null if the prefix is not in scope. Return "" if the prefix maps to the null namespace.
Parameters: source A Source object identifying the schema document to be loaded
Throws: net.sf.saxon.type.SchemaException if the schema contained in this document is invalid UnsupportedOperationException if the configuration is not schema-aware
Parameters: type the supposedly built-in type. This will always be a type in the XS or XDT namespace.
Returns: true if this type can be used in this static context
Returns: This implementation always returns false: the standalone XPath API does not support schema-aware processing.
Returns: false; XPath 1.0 compatibility mode is not supported in the standalone XPath API
Parameters: backwardsCompatible if true, expressions will be evaluated with XPath 1.0 compatibility mode set to true.
Parameters: node The node whose in-scope namespaces are to be used as the context namespaces. Note that this will have no effect unless this node is an element.
Parameters: resolver A JAXP 1.3 XPathVariableResolver