Package net.sf.saxon.sxpath
Interface XPathStaticContext
- All Superinterfaces:
StaticContext
- All Known Implementing Classes:
IndependentContext
,SchemaElement.XPathStaticContext
This interface defines methods that must be provided when Saxon's free-standing XPath API is used.
The default implementation of this interface is
IndependentContext
, and
that implementation should be adequate for most purposes; but for extra customization, a user-written
implementation of this interface may be used instead.-
Method Summary
Modifier and TypeMethodDescriptiondeclareVariable
(NamespaceUri namespaceURI, String localName) Declare a variable.declareVariable
(QNameValue qname) Declare a variable.Get a Stack Frame Map containing definitions of all the declared variables.boolean
Ask whether the context item is known to be parentlessvoid
Set the default namespace for elements and typesvoid
setNamespaceResolver
(NamespaceResolver resolver) Set an external namespace resolver.Methods inherited from interface net.sf.saxon.expr.StaticContext
bindVariable, getConfiguration, getContainingLocation, getDecimalFormatManager, getDefaultCollationName, getDefaultElementNamespace, getDefaultFunctionNamespace, getFunctionLibrary, getImportedSchemaNamespaces, getKeyManager, getNamespaceResolver, getOptimizerOptions, getPackageData, getRequiredContextItemType, getStaticBaseURI, getSystemId, getUnprefixedElementMatchingPolicy, getXPathVersion, isImportedSchema, isInBackwardsCompatibleMode, issueWarning, makeEarlyEvaluationContext, makeRetainedStaticContext, resolveTypeAlias
-
Method Details
-
setDefaultElementNamespace
Set the default namespace for elements and types- Parameters:
uri
- The namespace to be used to qualify unprefixed element names and type names appearing in the XPath expression.
-
setNamespaceResolver
Set an external namespace resolver. If this is set, then all resolution of namespace prefixes is delegated to the external namespace resolver, and namespaces declared individually on this IndependentContext object are ignored.- Parameters:
resolver
- the external namespace resolver
-
declareVariable
Declare a variable. A variable must be declared before an expression referring to it is compiled. The initial value of the variable will be the empty sequence.- Parameters:
qname
- The name of the variable- Returns:
- a Variable object representing information about the variable that has been declared.
-
declareVariable
Declare a variable. A variable must be declared before an expression referring to it is compiled. The initial value of the variable will be the empty sequence.- Parameters:
namespaceURI
- The namespace URI of the name of the variable. Supply "" to represent names in no namespace (null is also accepted)localName
- The local part of the name of the variable (an NCName)- Returns:
- an XPathVariable object representing information about the variable that has been declared.
-
getStackFrameMap
SlotManager getStackFrameMap()Get a Stack Frame Map containing definitions of all the declared variables. This will return a newly created object that the caller is free to modify by adding additional variables, without affecting the static context itself.- Returns:
- a SlotManager object holding details of the allocation of variables on the stack frame.
-
isContextItemParentless
boolean isContextItemParentless()Ask whether the context item is known to be parentless- Returns:
- true if it is known that the context item for evaluating the expression will have no parent
-