|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Interface for navigating around an arbitrary object model, using XPath semantics.
There is a method to obtain a java.util.Iterator
,
for each axis specified by XPath. If the target object model
does not support the semantics of a particular axis, an
UnsupportedAxisException
is to be thrown. If there are
no nodes on that axis, an empty iterator should be returned.
Method Summary | |
Iterator |
getAncestorAxisIterator(Object contextNode)
Retrieve an Iterator matching the ancestor
XPath axis. |
Iterator |
getAncestorOrSelfAxisIterator(Object contextNode)
Retrieve an Iterator matching the
ancestor-or-self XPath axis. |
Iterator |
getAttributeAxisIterator(Object contextNode)
Retrieve an Iterator matching the attribute
XPath axis. |
String |
getAttributeName(Object attr)
Retrieve the local name of the given attribute node. |
String |
getAttributeNamespaceUri(Object attr)
Retrieve the namespace URI of the given attribute node. |
String |
getAttributeQName(Object attr)
Retrieve the qualified name of the given attribute node. |
String |
getAttributeStringValue(Object attr)
Retrieve the string-value of an attribute node. |
Iterator |
getChildAxisIterator(Object contextNode)
Retrieve an Iterator matching the child
XPath axis. |
String |
getCommentStringValue(Object comment)
Retrieve the string-value of a comment node. |
Iterator |
getDescendantAxisIterator(Object contextNode)
Retrieve an Iterator matching the descendant
XPath axis. |
Iterator |
getDescendantOrSelfAxisIterator(Object contextNode)
Retrieve an Iterator matching the
descendant-or-self XPath axis. |
Object |
getDocument(String uri)
Loads a document from the given URI |
Object |
getDocumentNode(Object contextNode)
Returns the document node that contains the given context node. |
Object |
getElementById(Object contextNode,
String elementId)
Returns the element whose ID is given by elementId. |
String |
getElementName(Object element)
Retrieve the local name of the given element node. |
String |
getElementNamespaceUri(Object element)
Retrieve the namespace URI of the given element node. |
String |
getElementQName(Object element)
Retrieve the qualified name of the given element node. |
String |
getElementStringValue(Object element)
Retrieve the string-value of an element node. |
Iterator |
getFollowingAxisIterator(Object contextNode)
Retrieve an Iterator matching the following
XPath axis. |
Iterator |
getFollowingSiblingAxisIterator(Object contextNode)
Retrieve an Iterator matching the
following-sibling XPath axis. |
Iterator |
getNamespaceAxisIterator(Object contextNode)
Retrieve an Iterator matching the namespace
XPath axis. |
String |
getNamespacePrefix(Object ns)
Retrieve the namespace prefix of a namespace node. |
String |
getNamespaceStringValue(Object ns)
Retrieve the string-value of a namespace node. |
short |
getNodeType(Object node)
Returns a number that identifies the type of node that the given object represents in this navigator. |
Iterator |
getParentAxisIterator(Object contextNode)
Retrieve an Iterator matching the parent XPath axis. |
Object |
getParentNode(Object contextNode)
Returns the parent of the given context node. |
Iterator |
getPrecedingAxisIterator(Object contextNode)
Retrieve an Iterator matching the preceding XPath axis. |
Iterator |
getPrecedingSiblingAxisIterator(Object contextNode)
Retrieve an Iterator matching the
preceding-sibling XPath axis. |
String |
getProcessingInstructionData(Object pi)
Retrieve the data of a processing-instruction. |
String |
getProcessingInstructionTarget(Object pi)
Retrieve the target of a processing-instruction. |
Iterator |
getSelfAxisIterator(Object contextNode)
Retrieve an Iterator matching the self XPath
axis. |
String |
getTextStringValue(Object text)
Retrieve the string-value of a text node. |
boolean |
isAttribute(Object object)
Returns whether the given object is an attribute node. |
boolean |
isComment(Object object)
Returns whether the given object is a comment node. |
boolean |
isDocument(Object object)
Returns whether the given object is a document node. |
boolean |
isElement(Object object)
Returns whether the given object is an element node. |
boolean |
isNamespace(Object object)
Returns whether the given object is a namespace node. |
boolean |
isProcessingInstruction(Object object)
Returns whether the given object is a processing-instruction node. |
boolean |
isText(Object object)
Returns whether the given object is a text node. |
XPath |
parseXPath(String xpath)
Returns a parsed form of the given XPath string, which will be suitable for queries on documents that use the same navigator as this one. |
String |
translateNamespacePrefixToUri(String prefix,
Object element)
Translate a namespace prefix to a namespace URI, possibly considering a particular element node. |
Method Detail |
public Iterator getChildAxisIterator(Object contextNode) throws UnsupportedAxisException
Iterator
matching the child
XPath axis.
contextNode
- the original context node
UnsupportedAxisException
- if the semantics of the child axis are
not supported by this object modelpublic Iterator getDescendantAxisIterator(Object contextNode) throws UnsupportedAxisException
Iterator
matching the descendant
XPath axis.
contextNode
- the original context node
UnsupportedAxisException
- if the semantics of the desscendant axis are
not supported by this object modelpublic Iterator getParentAxisIterator(Object contextNode) throws UnsupportedAxisException
Iterator
matching the parent
XPath axis.
contextNode
- the original context node
UnsupportedAxisException
- if the semantics of the parent axis are
not supported by this object modelpublic Iterator getAncestorAxisIterator(Object contextNode) throws UnsupportedAxisException
Iterator
matching the ancestor
XPath axis.
contextNode
- the original context node
UnsupportedAxisException
- if the semantics of the ancestor axis are
not supported by this object modelpublic Iterator getFollowingSiblingAxisIterator(Object contextNode) throws UnsupportedAxisException
Iterator
matching the
following-sibling
XPath axis.
contextNode
- the original context node
UnsupportedAxisException
- if the semantics of the following-sibling axis are
not supported by this object modelpublic Iterator getPrecedingSiblingAxisIterator(Object contextNode) throws UnsupportedAxisException
Iterator
matching the
preceding-sibling
XPath axis.
contextNode
- the original context node
UnsupportedAxisException
- if the semantics of the preceding-sibling axis are
not supported by this object modelpublic Iterator getFollowingAxisIterator(Object contextNode) throws UnsupportedAxisException
Iterator
matching the following
XPath axis.
contextNode
- the original context node
UnsupportedAxisException
- if the semantics of the following axis are
not supported by this object modelpublic Iterator getPrecedingAxisIterator(Object contextNode) throws UnsupportedAxisException
Iterator
matching the preceding
XPath axis.
contextNode
- the original context node
UnsupportedAxisException
- if the semantics of the preceding axis are
not supported by this object modelpublic Iterator getAttributeAxisIterator(Object contextNode) throws UnsupportedAxisException
Iterator
matching the attribute
XPath axis.
contextNode
- the original context node
UnsupportedAxisException
- if the semantics of the attribute axis are
not supported by this object modelpublic Iterator getNamespaceAxisIterator(Object contextNode) throws UnsupportedAxisException
Iterator
matching the namespace
XPath axis.
contextNode
- the original context node
UnsupportedAxisException
- if the semantics of the namespace axis are
not supported by this object modelpublic Iterator getSelfAxisIterator(Object contextNode) throws UnsupportedAxisException
Iterator
matching the self
XPath
axis.
contextNode
- the original context node
UnsupportedAxisException
- if the semantics of the self axis are
not supported by this object modelpublic Iterator getDescendantOrSelfAxisIterator(Object contextNode) throws UnsupportedAxisException
Iterator
matching the
descendant-or-self
XPath axis.
contextNode
- the original context node
UnsupportedAxisException
- if the semantics of the descendant-or-self axis are
not supported by this object modelpublic Iterator getAncestorOrSelfAxisIterator(Object contextNode) throws UnsupportedAxisException
Iterator
matching the
ancestor-or-self
XPath axis.
contextNode
- the original context node
UnsupportedAxisException
- if the semantics of the ancestor-or-self axis are
not supported by this object modelpublic Object getDocument(String uri) throws FunctionCallException
uri
- the URI of the document to load
FunctionCallException
- if the document could not be loadedpublic Object getDocumentNode(Object contextNode)
contextNode
- the context node
isDocument(Object)
public Object getParentNode(Object contextNode) throws UnsupportedAxisException
The parent of any node must either be a document node or an element node.
contextNode
- the context node
UnsupportedAxisException
- if the parent axis is not
supported by the modelisDocument(java.lang.Object)
,
isElement(java.lang.Object)
public String getElementNamespaceUri(Object element)
element
- the context element node
public String getElementName(Object element)
element
- the context element node
public String getElementQName(Object element)
element
- the context element node
public String getAttributeNamespaceUri(Object attr)
attr
- the context attribute node
public String getAttributeName(Object attr)
attr
- the context attribute node
public String getAttributeQName(Object attr)
attr
- the context attribute node
public String getProcessingInstructionTarget(Object pi)
pi
- the context processing-instruction node
public String getProcessingInstructionData(Object pi)
pi
- the context processing-instruction node
public boolean isDocument(Object object)
/
.
object
- the object to test
true
if the object is a document node,
else false
public boolean isElement(Object object)
object
- the object to test
true
if the object is an element node,
else false
public boolean isAttribute(Object object)
object
- the object to test
true
if the object is an attribute node,
else false
public boolean isNamespace(Object object)
object
- the object to test
true
if the object is a namespace node,
else false
public boolean isComment(Object object)
object
- the object to test
true
if the object is a comment node,
else false
public boolean isText(Object object)
object
- the object to test
true
if the object is a text node,
else false
public boolean isProcessingInstruction(Object object)
object
- the object to test
true
if the object is a processing-instruction node,
else false
public String getCommentStringValue(Object comment)
comment
- the comment node
public String getElementStringValue(Object element)
element
- the comment node.
public String getAttributeStringValue(Object attr)
attr
- the attribute node
public String getNamespaceStringValue(Object ns)
ns
- the namespace node
public String getTextStringValue(Object text)
text
- the text node
public String getNamespacePrefix(Object ns)
ns
- the namespace node
public String translateNamespacePrefixToUri(String prefix, Object element)
Strictly speaking, prefix-to-URI translation should occur irrespective of any element in the document. This method is provided to allow a non-conforming ease-of-use enhancement.
prefix
- the prefix to translateelement
- the element to consider during translation
NamespaceContext
public XPath parseXPath(String xpath) throws SAXPathException
xpath
- the XPath expression
SAXPathException
- if the string is not a syntactically
correct XPath expressionXPath
public Object getElementById(Object contextNode, String elementId)
contextNode
- a node from the document in which to look for the
idelementId
- id to look for
public short getNodeType(Object node)
node
- ????
Pattern
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |