|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.saxon.sxpath.AbstractStaticContext
net.sf.saxon.sxpath.IndependentContext
public class IndependentContext
An IndependentContext provides a context for parsing an XPath expression appearing in a context other than a stylesheet.
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.
Constructor Summary | |
---|---|
IndependentContext()
|
|
IndependentContext(Configuration config)
Create an IndependentContext using a specific Configuration |
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). |
IndependentContext |
copy()
Create a copy of this IndependentContext. |
void |
declareNamespace(String prefix,
String uri)
Declare a namespace whose prefix can be used in expressions |
XPathVariable |
declareVariable(QNameValue qname)
Declare a variable. |
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. |
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. |
boolean |
isImportedSchema(String namespace)
Determine whether a Schema for a given target namespace has been imported. |
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. |
void |
setImportedSchemaNamespaces(Set 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. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.sf.saxon.sxpath.XPathStaticContext |
---|
getExecutable, setDefaultElementNamespace |
Methods inherited from interface net.sf.saxon.expr.StaticContext |
---|
getBaseURI, getCollation, getConfiguration, getDefaultCollationName, getDefaultElementNamespace, getDefaultFunctionNamespace, getFunctionLibrary, getLineNumber, getLocationMap, getNamePool, getSystemId, isAllowedBuiltInType, isInBackwardsCompatibleMode, makeEarlyEvaluationContext |
Methods inherited from interface net.sf.saxon.expr.Container |
---|
getHostLanguage, getLocationProvider, replaceSubExpression |
Methods inherited from interface javax.xml.transform.SourceLocator |
---|
getColumnNumber, getLineNumber, getPublicId, getSystemId |
Constructor Detail |
---|
public IndependentContext()
public IndependentContext(Configuration config)
Method Detail |
---|
public IndependentContext copy()
public void declareNamespace(String prefix, 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
in interface XPathStaticContext
public XPathVariable declareVariable(QNameValue qname)
declareVariable
in interface XPathStaticContext
qname
- The name of the variable
public int getSlotNumber(QNameValue qname)
public void issueWarning(String s, SourceLocator locator)
issueWarning
in interface StaticContext
issueWarning
in class AbstractStaticContext
public String getURIForPrefix(String prefix) throws XPathException
getURIForPrefix
in interface StaticContext
prefix
- The prefix
XPathException
- if the prefix is not declaredpublic NamespaceResolver getNamespaceResolver()
StaticContext
getNamespaceResolver
in interface StaticContext
public String getURIForPrefix(String prefix, boolean useDefault)
getURIForPrefix
in interface NamespaceResolver
prefix
- the namespace prefixuseDefault
- true if the default namespace is to be used when the
prefix is ""
public Iterator iteratePrefixes()
iteratePrefixes
in interface NamespaceResolver
public VariableReference bindVariable(int fingerprint) throws StaticError
bindVariable
in interface StaticContext
fingerprint
- the name of the variable
StaticError
public SlotManager getStackFrameMap()
getStackFrameMap
in interface XPathStaticContext
public boolean isImportedSchema(String namespace)
StaticContext
isImportedSchema
in interface StaticContext
public Set getImportedSchemaNamespaces()
getImportedSchemaNamespaces
in interface StaticContext
public void setImportedSchemaNamespaces(Set namespaces)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |