org.exolab.adaptx.xpath
public class XPathContext extends Object
Impelementations may wish to extend this class and provide additional facilities for locating the document order of a node, or providing a function library.
Version: $Revision: 3633 $
Constructor Summary | |
---|---|
XPathContext(XPathNode node)
Constructs a new XPath context using the given node
as the context node. | |
XPathContext(XPathNode node, VariableSet variables)
Constructs a new XPath context using the given node as
as the context node. | |
XPathContext(VariableSet variables, NodeSet nodeSet, int position)
Constructs a new XPath context. |
Method Summary | |
---|---|
void | addNamespaceBinding(String prefix, String namespace)
Creates a binding within this XPathContext between a given prefix
and a namespace URI. |
int[] | getDocumentOrder(XPathNode node)
Returns the document order of the given node.
|
XPathNode | getElementById(XPathNode root, String id)
Returns the element associated with the given identifier.
|
XPathFunction | getFunction(String uri, String name)
Returns the XPath function by the given name, or null if no
such function is defined.
|
String | getNamespaceURI(String prefix)
Returns the namespace associated with the given prefix as
defined in this context. |
XPathNode | getNode()
Returns the context node of this XPathContext
|
NodeSet | getNodeSet()
Returns the current context node-set.
|
int | getPosition()
Returns the position of the context node. |
int | getSize()
Returns the size of the context.
|
XPathResult | getVariable(String name)
Returns the XPath result bound to the given variable name.
|
XPathContext | newContext(XPathNode node)
Creates a new XPathContext with this XPathContext as it's
parent.
|
XPathContext | newContext(NodeSet nodeSet, int position)
Creates a new XPathContext with this XPathContext as it's
parent.
|
NodeSet | newNodeSet(int size)
Constructs and returns a new node-set with the specified size.
|
NodeSet | newNodeSet(XPathNode node)
Constructs and returns a new node-set with one node.
|
NodeSet | newNodeSet()
Constructs and returns a new empty node-set.
|
void | setNodeSet(NodeSet nodeSet, int position)
Sets the given node-set as the context node-set for
this XPathContext
|
void | setPosition(int position)
Sets the position of the context node within the context
node-set
|
Parameters: node the context XPathNode.
Parameters: node the context XPathNode. variable Variable bindings, or null
Parameters: variable Variable bindings, or null nodeSet the context node-set for this XPathContext position The position of the context node (zero base)
Parameters: prefix the prefix to associate with the namespace namespace the namespace URI.
Returns: The document order of the given node
Parameters: root The root node id The element's identifier
Returns: The first element in document order with the given identifier, or null if no such element was found
Parameters: uri The function's namespace URI name The function's name within that URI
Returns: The XPath function by the given name, or null if no such function is defined
Parameters: prefix the namespace prefix
Returns: the namespace uri or null.
Returns: the context node
Returns: The current context node-set
Returns: The position of the context node
See Also: XPathContext
Returns: The size of the context
Parameters: name The variable name
Returns: The variable's value
Returns: the new XPathContext
Returns: the new XPathContext
Parameters: size The size of the node-set
Returns: A new node-set with that size
Parameters: node The node to include in the node-set
Returns: A new node-set
Returns: A new empty node-set
Parameters: nodeSet the node-set to use as the context node-set. position the position of the context node
Parameters: the position of the context node within the context node-set
Throws: IndexOutOfBoundsException when the position is not within the bounds of the context node-set.