public class IndependentContext extends AbstractStaticContext implements XPathStaticContext, NamespaceResolver, java.io.Serializable, Container
This class is used in a number of places where freestanding XPath expressions occur. These include the native Saxon XPath API, the .NET XPath API, XPath expressions used in XML Schema identity constraints, and XPath expressions supplied to saxon:evaluate(). It is not used by the JAXP XPath API (though it shares code with that API through the common superclass AbstractStaticContext).
This class currently provides no mechanism for binding user-defined functions.
?????? |
---|
IndependentContext()
Create an IndependentContext along with a new (non-schema-aware) Saxon Configuration
|
IndependentContext(Configuration config)
Create an IndependentContext using a specific Configuration
|
?????? | ????? |
---|---|
VariableReference |
bindVariable(StructuredQName qName)
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).
|
IndependentContext |
copy()
Create a copy of this IndependentContext.
|
void |
declareNamespace(java.lang.String prefix,
java.lang.String uri)
Declare a namespace whose prefix can be used in expressions
|
XPathVariable |
declareVariable(QNameValue qname)
Declare a variable.
|
XPathVariable |
declareVariable(java.lang.String namespaceURI,
java.lang.String localName)
Declare a variable.
|
java.util.Set |
getImportedSchemaNamespaces()
Get the set of imported schemas
|
NamespaceResolver |
getNamespaceResolver()
Get a namespace resolver to resolve the namespaces declared in this static context.
|
int |
getSlotNumber(QNameValue qname)
Get the slot number allocated to a particular variable
|
SlotManager |
getStackFrameMap()
Get a Stack Frame Map containing definitions of all the declared variables.
|
java.lang.String |
getURIForPrefix(java.lang.String prefix)
Get the URI for a prefix, using the declared namespaces as
the context for namespace resolution.
|
java.lang.String |
getURIForPrefix(java.lang.String prefix,
boolean useDefault)
Get the namespace URI corresponding to a given prefix.
|
boolean |
isImportedSchema(java.lang.String namespace)
Determine whether a Schema for a given target namespace has been imported.
|
java.util.Iterator |
iteratePrefixes()
Get an iterator over all the prefixes declared in this namespace context.
|
void |
setImportedSchemaNamespaces(java.util.Set namespaces)
Register the set of imported schema namespaces
|
void |
setNamespaceResolver(NamespaceResolver resolver)
Set an external namespace resolver.
|
void |
setNamespaces(NodeInfo node)
Declares all the namespaces that are in-scope for a given node, removing all previous
namespace declarations.
|
addFunctionLibrary, declareCollation, getBaseURI, getCollation, getColumnNumber, getConfiguration, getDefaultCollationName, getDefaultElementNamespace, getDefaultFunctionNamespace, getExecutable, getFunctionLibrary, getHostLanguage, getLineNumber, getLocationMap, getLocationProvider, getNamePool, getPublicId, getSystemId, isAllowedBuiltInType, isInBackwardsCompatibleMode, issueWarning, makeEarlyEvaluationContext, replaceSubExpression, setBackwardsCompatibilityMode, setBaseURI, setConfiguration, setDefaultElementNamespace, setDefaultFunctionLibrary, setDefaultFunctionNamespace, setFunctionLibrary, setLocationMap
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getExecutable, setDefaultElementNamespace
getBaseURI, getCollation, getConfiguration, getDefaultCollationName, getDefaultElementNamespace, getDefaultFunctionNamespace, getFunctionLibrary, getLineNumber, getLocationMap, getNamePool, getSystemId, isAllowedBuiltInType, isInBackwardsCompatibleMode, issueWarning, makeEarlyEvaluationContext
getHostLanguage, getLocationProvider, replaceSubExpression
public IndependentContext()
public IndependentContext(Configuration config)
config
- the Saxon configuration to be usedpublic IndependentContext copy()
public void declareNamespace(java.lang.String prefix, java.lang.String uri)
prefix
- The namespace prefix. Must not be null. Supplying "" sets the
default element namespace.uri
- The namespace URI. Must not be null.public void clearNamespaces()
public void clearAllNamespaces()
public void setNamespaces(NodeInfo node)
node
- The node whose in-scope namespaces are to be used as the context namespaces.
If the node is an attribute, text node, etc, then the namespaces of its parent element are used.public void setNamespaceResolver(NamespaceResolver resolver)
setNamespaceResolver
???? XPathStaticContext
resolver
- the external NamespaceResolverpublic XPathVariable declareVariable(QNameValue qname)
declareVariable
???? XPathStaticContext
qname
- The name of the variablepublic XPathVariable declareVariable(java.lang.String namespaceURI, java.lang.String localName)
declareVariable
???? XPathStaticContext
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)public int getSlotNumber(QNameValue qname)
qname
- the name of the variablepublic java.lang.String getURIForPrefix(java.lang.String prefix) throws XPathException
getURIForPrefix
???? StaticContext
prefix
- The prefixXPathException
- if the prefix is not declaredpublic NamespaceResolver getNamespaceResolver()
StaticContext
getNamespaceResolver
???? StaticContext
public java.lang.String getURIForPrefix(java.lang.String prefix, boolean useDefault)
getURIForPrefix
???? NamespaceResolver
prefix
- the namespace prefixuseDefault
- true if the default namespace is to be used when the
prefix is ""public java.util.Iterator iteratePrefixes()
iteratePrefixes
???? NamespaceResolver
public VariableReference bindVariable(StructuredQName qName) throws XPathException
bindVariable
???? StaticContext
qName
- the name of the variableXPathException
public SlotManager getStackFrameMap()
getStackFrameMap
???? XPathStaticContext
public boolean isImportedSchema(java.lang.String namespace)
StaticContext
isImportedSchema
???? StaticContext
namespace
- the target namespace in questionpublic java.util.Set getImportedSchemaNamespaces()
getImportedSchemaNamespaces
???? StaticContext
public void setImportedSchemaNamespaces(java.util.Set namespaces)
namespaces
- the set of namespaces for which schema components are available in the
static context