public class DocumentNavigator
extends org.jaxen.DefaultNavigator
Constructor and Description |
---|
DocumentNavigator() |
Modifier and Type | Method and Description |
---|---|
Iterator |
getAncestorAxisIterator(Object contextNode)
Retrieves an
Iterator matching the ancestor XPath axis. |
Iterator |
getAncestorOrSelfAxisIterator(Object contextNode)
Retrieves an
Iterator matching the ancestor-or-self XPath axis. |
Iterator |
getAttributeAxisIterator(Object contextNode)
Retrieves an
Iterator matching the attribute XPath axis. |
String |
getAttributeName(Object object)
Retrieves the name of the given attribute node.
|
String |
getAttributeNamespaceUri(Object object)
Retrieves the namespace URI of the given attribute node.
|
String |
getAttributeQName(Object object)
Retrieves the QName of the given attribute node.
|
String |
getAttributeStringValue(Object object)
Retrieves the string-value of an attribute node.
|
Iterator |
getChildAxisIterator(Object contextNode)
Retrieves an
Iterator matching the child XPath axis. |
String |
getCommentStringValue(Object object)
Retrieves the string-value of a comment node.
|
Iterator |
getDescendantAxisIterator(Object object) |
Iterator |
getDescendantOrSelfAxisIterator(Object contextNode)
Retrieves 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 object)
Retrieves the name of the given element node.
|
String |
getElementNamespaceUri(Object object)
Retrieves the namespace URI of the given element node.
|
String |
getElementQName(Object object)
Retrieves the QName of the given element node.
|
String |
getElementStringValue(Object object)
Retrieves the string-value of an element node.
|
Iterator |
getFollowingAxisIterator(Object contextNode)
Retrieves an
Iterator matching the following XPath axis. |
Iterator |
getFollowingSiblingAxisIterator(Object contextNode)
Retrieves an
Iterator matching the following-sibling XPath axis. |
Iterator |
getNamespaceAxisIterator(Object contextNode)
Retrieves an
Iterator matching the namespace XPath axis. |
String |
getNamespacePrefix(Object object)
Retrieves the namespace prefix of a namespace node.
|
String |
getNamespaceStringValue(Object object)
Retrieves 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)
Retrieves an
Iterator matching the parent XPath axis. |
Object |
getParentNode(Object contextNode)
Returns the parent of the given context node.
|
Iterator |
getPrecedingAxisIterator(Object contextNode)
Retrieves an
Iterator matching the preceding XPath axis. |
Iterator |
getPrecedingSiblingAxisIterator(Object contextNode)
Retrieves an
Iterator matching the preceding-sibling XPath axis. |
String |
getProcessingInstructionData(Object object)
Retrieves the data of a processing-instruction.
|
String |
getProcessingInstructionTarget(Object object)
Retrieves the target of a processing-instruction.
|
Iterator |
getSelfAxisIterator(Object contextNode)
Retrieves an
Iterator matching the self xpath axis. |
String |
getTextStringValue(Object object)
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.
|
org.jaxen.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)
Translates a namespace prefix to a namespace URI, possibly considering a particular
element node.
|
public org.jaxen.XPath parseXPath(String xpath) throws org.jaxen.saxpath.SAXPathException
xpath
- the XPath expressionorg.jaxen.saxpath.SAXPathException
- if the string is not a syntactically correct XPath expressionXPath
public String getElementNamespaceUri(Object object)
object
- the context element nodepublic String getElementName(Object object)
object
- the context element nodepublic String getElementQName(Object object)
object
- the context element nodepublic String getAttributeNamespaceUri(Object object)
object
- the context attribute nodepublic String getAttributeName(Object object)
object
- the context attribute nodepublic String getAttributeQName(Object object)
object
- the context attribute nodepublic boolean isDocument(Object object)
/
.object
- the object to testtrue
if the object is a document node, else false
.public boolean isElement(Object object)
object
- the object to testtrue
if the object is an element node, else false
.public boolean isAttribute(Object object)
object
- the object to testtrue
if the object is an attribute node, else false
.public boolean isNamespace(Object object)
object
- the object to testtrue
if the object is a namespace node, else false
.public boolean isComment(Object object)
object
- the object to testtrue
if the object is a comment node, else false
.public boolean isText(Object object)
object
- the object to testtrue
if the object is a text node, else false
.public boolean isProcessingInstruction(Object object)
object
- the object to testtrue
if the object is a processing-instruction node, else
false
.public String getCommentStringValue(Object object)
object
- the comment nodepublic String getElementStringValue(Object object)
object
- the comment node.public String getAttributeStringValue(Object object)
object
- the attribute nodepublic String getNamespaceStringValue(Object object)
object
- the namespace nodepublic String getTextStringValue(Object object)
object
- the text nodepublic String getNamespacePrefix(Object object)
object
- the namespace nodepublic Iterator getChildAxisIterator(Object contextNode) throws org.jaxen.UnsupportedAxisException
Iterator
matching the child
XPath axis.getChildAxisIterator
in interface org.jaxen.Navigator
getChildAxisIterator
in class org.jaxen.DefaultNavigator
contextNode
- the original context nodeorg.jaxen.UnsupportedAxisException
- if the semantics of the child axis are not supported by this
object modelpublic Iterator getDescendantAxisIterator(Object object) throws org.jaxen.UnsupportedAxisException
getDescendantAxisIterator
in interface org.jaxen.Navigator
getDescendantAxisIterator
in class org.jaxen.DefaultNavigator
org.jaxen.UnsupportedAxisException
public Iterator getAttributeAxisIterator(Object contextNode) throws org.jaxen.UnsupportedAxisException
Iterator
matching the attribute
XPath axis.getAttributeAxisIterator
in interface org.jaxen.Navigator
getAttributeAxisIterator
in class org.jaxen.DefaultNavigator
contextNode
- the original context nodeorg.jaxen.UnsupportedAxisException
- if the semantics of the attribute axis are not supported by
this object modelpublic Iterator getNamespaceAxisIterator(Object contextNode) throws org.jaxen.UnsupportedAxisException
Iterator
matching the namespace
XPath axis.getNamespaceAxisIterator
in interface org.jaxen.Navigator
getNamespaceAxisIterator
in class org.jaxen.DefaultNavigator
contextNode
- the original context nodeorg.jaxen.UnsupportedAxisException
- if the semantics of the namespace axis are not supported by
this object modelpublic Iterator getSelfAxisIterator(Object contextNode) throws org.jaxen.UnsupportedAxisException
Iterator
matching the self
xpath axis.getSelfAxisIterator
in interface org.jaxen.Navigator
getSelfAxisIterator
in class org.jaxen.DefaultNavigator
contextNode
- the original context nodeorg.jaxen.UnsupportedAxisException
- if the semantics of the self axis are not supported by this
object modelpublic Iterator getDescendantOrSelfAxisIterator(Object contextNode) throws org.jaxen.UnsupportedAxisException
Iterator
matching the descendant-or-self
XPath axis.getDescendantOrSelfAxisIterator
in interface org.jaxen.Navigator
getDescendantOrSelfAxisIterator
in class org.jaxen.DefaultNavigator
contextNode
- the original context nodeorg.jaxen.UnsupportedAxisException
- if the semantics of the descendant-or-self axis are not
supported by this object modelpublic Iterator getAncestorOrSelfAxisIterator(Object contextNode) throws org.jaxen.UnsupportedAxisException
Iterator
matching the ancestor-or-self
XPath axis.getAncestorOrSelfAxisIterator
in interface org.jaxen.Navigator
getAncestorOrSelfAxisIterator
in class org.jaxen.DefaultNavigator
contextNode
- the original context nodeorg.jaxen.UnsupportedAxisException
- if the semantics of the ancestor-or-self axis are not
supported by this object modelpublic Iterator getParentAxisIterator(Object contextNode) throws org.jaxen.UnsupportedAxisException
Iterator
matching the parent
XPath axis.getParentAxisIterator
in interface org.jaxen.Navigator
getParentAxisIterator
in class org.jaxen.DefaultNavigator
contextNode
- the original context nodeorg.jaxen.UnsupportedAxisException
- if the semantics of the parent axis are not supported by
this object modelpublic Iterator getAncestorAxisIterator(Object contextNode) throws org.jaxen.UnsupportedAxisException
Iterator
matching the ancestor
XPath axis.getAncestorAxisIterator
in interface org.jaxen.Navigator
getAncestorAxisIterator
in class org.jaxen.DefaultNavigator
contextNode
- the original context nodeorg.jaxen.UnsupportedAxisException
- if the semantics of the ancestor axis are not supported by
this object modelpublic Iterator getFollowingSiblingAxisIterator(Object contextNode) throws org.jaxen.UnsupportedAxisException
Iterator
matching the following-sibling
XPath axis.getFollowingSiblingAxisIterator
in interface org.jaxen.Navigator
getFollowingSiblingAxisIterator
in class org.jaxen.DefaultNavigator
contextNode
- the original context nodeorg.jaxen.UnsupportedAxisException
- if the semantics of the following-sibling axis are not
supported by this object modelpublic Iterator getPrecedingSiblingAxisIterator(Object contextNode) throws org.jaxen.UnsupportedAxisException
Iterator
matching the preceding-sibling
XPath axis.getPrecedingSiblingAxisIterator
in interface org.jaxen.Navigator
getPrecedingSiblingAxisIterator
in class org.jaxen.DefaultNavigator
contextNode
- the original context nodeorg.jaxen.UnsupportedAxisException
- if the semantics of the preceding-sibling axis are not
supported by this object modelpublic Iterator getFollowingAxisIterator(Object contextNode) throws org.jaxen.UnsupportedAxisException
Iterator
matching the following
XPath axis.getFollowingAxisIterator
in interface org.jaxen.Navigator
getFollowingAxisIterator
in class org.jaxen.DefaultNavigator
contextNode
- the original context nodeorg.jaxen.UnsupportedAxisException
- if the semantics of the following axis are not supported by
this object modelpublic Iterator getPrecedingAxisIterator(Object contextNode) throws org.jaxen.UnsupportedAxisException
Iterator
matching the preceding
XPath axis.getPrecedingAxisIterator
in interface org.jaxen.Navigator
getPrecedingAxisIterator
in class org.jaxen.DefaultNavigator
contextNode
- the original context nodeorg.jaxen.UnsupportedAxisException
- if the semantics of the preceding axis are not supported by
this object modelpublic Object getDocument(String uri) throws org.jaxen.FunctionCallException
getDocument
in interface org.jaxen.Navigator
getDocument
in class org.jaxen.DefaultNavigator
uri
- the URI of the document to loadorg.jaxen.FunctionCallException
- if the document could not be loadedpublic Object getElementById(Object contextNode, String elementId)
getElementById
in interface org.jaxen.Navigator
getElementById
in class org.jaxen.DefaultNavigator
contextNode
- a node from the document in which to look for the idelementId
- id to look forpublic Object getDocumentNode(Object contextNode)
getDocumentNode
in interface org.jaxen.Navigator
getDocumentNode
in class org.jaxen.DefaultNavigator
contextNode
- the context nodeisDocument(Object)
public String translateNamespacePrefixToUri(String prefix, Object element)
translateNamespacePrefixToUri
in interface org.jaxen.Navigator
translateNamespacePrefixToUri
in class org.jaxen.DefaultNavigator
prefix
- the prefix to translateelement
- the element to consider during translationpublic String getProcessingInstructionTarget(Object object)
getProcessingInstructionTarget
in interface org.jaxen.Navigator
getProcessingInstructionTarget
in class org.jaxen.DefaultNavigator
object
- the context processing-instruction nodepublic String getProcessingInstructionData(Object object)
getProcessingInstructionData
in interface org.jaxen.Navigator
getProcessingInstructionData
in class org.jaxen.DefaultNavigator
object
- the context processing-instruction nodepublic short getNodeType(Object node)
getNodeType
in interface org.jaxen.Navigator
getNodeType
in class org.jaxen.DefaultNavigator
node
- ????public Object getParentNode(Object contextNode) throws org.jaxen.UnsupportedAxisException
getParentNode
in interface org.jaxen.Navigator
getParentNode
in class org.jaxen.DefaultNavigator
contextNode
- the context nodeorg.jaxen.UnsupportedAxisException
- if the parent axis is not supported by the modelisDocument(java.lang.Object)
,
isElement(java.lang.Object)
Copyright © 2004-2013 The Apache Software Foundation. All Rights Reserved.