Package org.apache.axiom.om.xpath
Class DocumentNavigator
java.lang.Object
org.jaxen.DefaultNavigator
org.apache.axiom.om.xpath.DocumentNavigator
- All Implemented Interfaces:
Serializable,org.jaxen.Navigator
public class DocumentNavigator
extends org.jaxen.DefaultNavigator
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionIterator<?>getAncestorAxisIterator(Object contextNode) Retrieves anIteratormatching theancestorXPath axis.Iterator<?>getAncestorOrSelfAxisIterator(Object contextNode) Retrieves anIteratormatching theancestor-or-selfXPath axis.Iterator<?>getAttributeAxisIterator(Object contextNode) Retrieves anIteratormatching theattributeXPath axis.getAttributeName(Object object) Retrieves the name of the given attribute node.getAttributeNamespaceUri(Object object) Retrieves the namespace URI of the given attribute node.getAttributeQName(Object object) Retrieves the QName of the given attribute node.getAttributeStringValue(Object object) Retrieves the string-value of an attribute node.Iterator<?>getChildAxisIterator(Object contextNode) Retrieves anIteratormatching thechildXPath axis.getCommentStringValue(Object object) Retrieves the string-value of a comment node.Iterator<?>getDescendantAxisIterator(Object object) Iterator<?>getDescendantOrSelfAxisIterator(Object contextNode) Retrieves anIteratormatching thedescendant-or-selfXPath axis.getDocument(String uri) Loads a document from the given URI.getDocumentNode(Object contextNode) Returns the document node that contains the given context node.getElementById(Object contextNode, String elementId) Returns the element whose ID is given by elementId.getElementName(Object object) Retrieves the name of the given element node.getElementNamespaceUri(Object object) Retrieves the namespace URI of the given element node.getElementQName(Object object) Retrieves the QName of the given element node.getElementStringValue(Object object) Retrieves the string-value of an element node.Iterator<?>getFollowingAxisIterator(Object contextNode) Retrieves anIteratormatching thefollowingXPath axis.Iterator<?>getFollowingSiblingAxisIterator(Object contextNode) Retrieves anIteratormatching thefollowing-siblingXPath axis.Iterator<?>getNamespaceAxisIterator(Object contextNode) Retrieves anIteratormatching thenamespaceXPath axis.getNamespacePrefix(Object object) Retrieves the namespace prefix of a namespace node.getNamespaceStringValue(Object object) Retrieves the string-value of a namespace node.shortgetNodeType(Object node) Returns a number that identifies the type of node that the given object represents in this navigator.Iterator<?>getParentAxisIterator(Object contextNode) Retrieves anIteratormatching theparentXPath axis.getParentNode(Object contextNode) Returns the parent of the given context node.Iterator<?>getPrecedingAxisIterator(Object contextNode) Retrieves anIteratormatching theprecedingXPath axis.Iterator<?>getPrecedingSiblingAxisIterator(Object contextNode) Retrieves anIteratormatching thepreceding-siblingXPath axis.getProcessingInstructionData(Object object) Retrieves the data of a processing-instruction.getProcessingInstructionTarget(Object object) Retrieves the target of a processing-instruction.Iterator<?>getSelfAxisIterator(Object contextNode) Retrieves anIteratormatching theselfxpath axis.getTextStringValue(Object object) Retrieve the string-value of a text node.booleanisAttribute(Object object) Returns whether the given object is an attribute node.booleanReturns whether the given object is a comment node.booleanisDocument(Object object) Returns whether the given object is a document node.booleanReturns whether the given object is an element node.booleanisNamespace(Object object) Returns whether the given object is a namespace node.booleanisProcessingInstruction(Object object) Returns whether the given object is a processing-instruction node.booleanReturns whether the given object is a text node.org.jaxen.XPathparseXPath(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.translateNamespacePrefixToUri(String prefix, Object element) Translates a namespace prefix to a namespace URI, possibly considering a particular element node.
-
Constructor Details
-
DocumentNavigator
public DocumentNavigator()
-
-
Method Details
-
parseXPath
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.- Parameters:
xpath- the XPath expression- Returns:
- Returns a new XPath expression object.
- Throws:
org.jaxen.saxpath.SAXPathException- if the string is not a syntactically correct XPath expression- See Also:
-
XPath
-
getElementNamespaceUri
Retrieves the namespace URI of the given element node.- Parameters:
object- the context element node- Returns:
- Returns the namespace URI of the element node.
-
getElementName
Retrieves the name of the given element node.- Parameters:
object- the context element node- Returns:
- Returns the name of the element node.
-
getElementQName
Retrieves the QName of the given element node.- Parameters:
object- the context element node- Returns:
- Returns the QName of the element node.
-
getAttributeNamespaceUri
Retrieves the namespace URI of the given attribute node.- Parameters:
object- the context attribute node- Returns:
- Returns the namespace URI of the attribute node.
-
getAttributeName
Retrieves the name of the given attribute node.- Parameters:
object- the context attribute node- Returns:
- Returns the name of the attribute node.
-
getAttributeQName
Retrieves the QName of the given attribute node.- Parameters:
object- the context attribute node- Returns:
- Returns the qualified name of the attribute node.
-
isDocument
Returns whether the given object is a document node. A document node is the node that is selected by the xpath expression/.- Parameters:
object- the object to test- Returns:
- Returns
trueif the object is a document node, elsefalse.
-
isElement
Returns whether the given object is an element node.- Parameters:
object- the object to test- Returns:
- Returns
trueif the object is an element node, elsefalse.
-
isAttribute
Returns whether the given object is an attribute node.- Parameters:
object- the object to test- Returns:
- Returns
trueif the object is an attribute node, elsefalse.
-
isNamespace
Returns whether the given object is a namespace node.- Parameters:
object- the object to test- Returns:
- Returns
trueif the object is a namespace node, elsefalse.
-
isComment
Returns whether the given object is a comment node.- Parameters:
object- the object to test- Returns:
- Returns
trueif the object is a comment node, elsefalse.
-
isText
Returns whether the given object is a text node.- Parameters:
object- the object to test- Returns:
- Returns
trueif the object is a text node, elsefalse.
-
isProcessingInstruction
Returns whether the given object is a processing-instruction node.- Parameters:
object- the object to test- Returns:
- Returns
trueif the object is a processing-instruction node, elsefalse.
-
getCommentStringValue
Retrieves the string-value of a comment node. This may be the empty string if the comment is empty, but must not be null.- Parameters:
object- the comment node- Returns:
- Returns the string-value of the node.
-
getElementStringValue
Retrieves the string-value of an element node. This may be the empty string if the element is empty, but must not be null.- Parameters:
object- the comment node.- Returns:
- Returns the string-value of the node.
-
getAttributeStringValue
Retrieves the string-value of an attribute node. This should be the XML 1.0 normalized attribute value. This may be the empty string but must not be null.- Parameters:
object- the attribute node- Returns:
- Returns the string-value of the node.
-
getNamespaceStringValue
Retrieves the string-value of a namespace node. This is generally the namespace URI. This may be the empty string but must not be null.- Parameters:
object- the namespace node- Returns:
- Returns the string-value of the node.
-
getTextStringValue
Retrieve the string-value of a text node. This must not be null and should not be the empty string. The XPath data model does not allow empty text nodes.- Parameters:
object- the text node- Returns:
- Returns the string-value of the node.
-
getNamespacePrefix
Retrieves the namespace prefix of a namespace node.- Parameters:
object- the namespace node- Returns:
- Returns the prefix associated with the node.
-
getChildAxisIterator
public Iterator<?> getChildAxisIterator(Object contextNode) throws org.jaxen.UnsupportedAxisException Retrieves anIteratormatching thechildXPath axis.- Specified by:
getChildAxisIteratorin interfaceorg.jaxen.Navigator- Overrides:
getChildAxisIteratorin classorg.jaxen.DefaultNavigator- Parameters:
contextNode- the original context node- Returns:
- Returns an Iterator capable of traversing the axis, not null.
- Throws:
org.jaxen.UnsupportedAxisException- if the semantics of the child axis are not supported by this object model
-
getDescendantAxisIterator
public Iterator<?> getDescendantAxisIterator(Object object) throws org.jaxen.UnsupportedAxisException - Specified by:
getDescendantAxisIteratorin interfaceorg.jaxen.Navigator- Overrides:
getDescendantAxisIteratorin classorg.jaxen.DefaultNavigator- Throws:
org.jaxen.UnsupportedAxisException
-
getAttributeAxisIterator
public Iterator<?> getAttributeAxisIterator(Object contextNode) throws org.jaxen.UnsupportedAxisException Retrieves anIteratormatching theattributeXPath axis.- Specified by:
getAttributeAxisIteratorin interfaceorg.jaxen.Navigator- Overrides:
getAttributeAxisIteratorin classorg.jaxen.DefaultNavigator- Parameters:
contextNode- the original context node- Returns:
- Returns an Iterator capable of traversing the axis, not null.
- Throws:
org.jaxen.UnsupportedAxisException- if the semantics of the attribute axis are not supported by this object model
-
getNamespaceAxisIterator
public Iterator<?> getNamespaceAxisIterator(Object contextNode) throws org.jaxen.UnsupportedAxisException Retrieves anIteratormatching thenamespaceXPath axis.- Specified by:
getNamespaceAxisIteratorin interfaceorg.jaxen.Navigator- Overrides:
getNamespaceAxisIteratorin classorg.jaxen.DefaultNavigator- Parameters:
contextNode- the original context node- Returns:
- Returns an Iterator capable of traversing the axis, not null.
- Throws:
org.jaxen.UnsupportedAxisException- if the semantics of the namespace axis are not supported by this object model
-
getSelfAxisIterator
public Iterator<?> getSelfAxisIterator(Object contextNode) throws org.jaxen.UnsupportedAxisException Retrieves anIteratormatching theselfxpath axis.- Specified by:
getSelfAxisIteratorin interfaceorg.jaxen.Navigator- Overrides:
getSelfAxisIteratorin classorg.jaxen.DefaultNavigator- Parameters:
contextNode- the original context node- Returns:
- Returns an Iterator capable of traversing the axis, not null.
- Throws:
org.jaxen.UnsupportedAxisException- if the semantics of the self axis are not supported by this object model
-
getDescendantOrSelfAxisIterator
public Iterator<?> getDescendantOrSelfAxisIterator(Object contextNode) throws org.jaxen.UnsupportedAxisException Retrieves anIteratormatching thedescendant-or-selfXPath axis.- Specified by:
getDescendantOrSelfAxisIteratorin interfaceorg.jaxen.Navigator- Overrides:
getDescendantOrSelfAxisIteratorin classorg.jaxen.DefaultNavigator- Parameters:
contextNode- the original context node- Returns:
- Returns an Iterator capable of traversing the axis, not null.
- Throws:
org.jaxen.UnsupportedAxisException- if the semantics of the descendant-or-self axis are not supported by this object model
-
getAncestorOrSelfAxisIterator
public Iterator<?> getAncestorOrSelfAxisIterator(Object contextNode) throws org.jaxen.UnsupportedAxisException Retrieves anIteratormatching theancestor-or-selfXPath axis.- Specified by:
getAncestorOrSelfAxisIteratorin interfaceorg.jaxen.Navigator- Overrides:
getAncestorOrSelfAxisIteratorin classorg.jaxen.DefaultNavigator- Parameters:
contextNode- the original context node- Returns:
- Returns an Iterator capable of traversing the axis, not null.
- Throws:
org.jaxen.UnsupportedAxisException- if the semantics of the ancestor-or-self axis are not supported by this object model
-
getParentAxisIterator
public Iterator<?> getParentAxisIterator(Object contextNode) throws org.jaxen.UnsupportedAxisException Retrieves anIteratormatching theparentXPath axis.- Specified by:
getParentAxisIteratorin interfaceorg.jaxen.Navigator- Overrides:
getParentAxisIteratorin classorg.jaxen.DefaultNavigator- Parameters:
contextNode- the original context node- Returns:
- Returns an Iterator capable of traversing the axis, not null.
- Throws:
org.jaxen.UnsupportedAxisException- if the semantics of the parent axis are not supported by this object model
-
getAncestorAxisIterator
public Iterator<?> getAncestorAxisIterator(Object contextNode) throws org.jaxen.UnsupportedAxisException Retrieves anIteratormatching theancestorXPath axis.- Specified by:
getAncestorAxisIteratorin interfaceorg.jaxen.Navigator- Overrides:
getAncestorAxisIteratorin classorg.jaxen.DefaultNavigator- Parameters:
contextNode- the original context node- Returns:
- Returns an Iterator capable of traversing the axis, not null.
- Throws:
org.jaxen.UnsupportedAxisException- if the semantics of the ancestor axis are not supported by this object model
-
getFollowingSiblingAxisIterator
public Iterator<?> getFollowingSiblingAxisIterator(Object contextNode) throws org.jaxen.UnsupportedAxisException Retrieves anIteratormatching thefollowing-siblingXPath axis.- Specified by:
getFollowingSiblingAxisIteratorin interfaceorg.jaxen.Navigator- Overrides:
getFollowingSiblingAxisIteratorin classorg.jaxen.DefaultNavigator- Parameters:
contextNode- the original context node- Returns:
- Returns an Iterator capable of traversing the axis, not null.
- Throws:
org.jaxen.UnsupportedAxisException- if the semantics of the following-sibling axis are not supported by this object model
-
getPrecedingSiblingAxisIterator
public Iterator<?> getPrecedingSiblingAxisIterator(Object contextNode) throws org.jaxen.UnsupportedAxisException Retrieves anIteratormatching thepreceding-siblingXPath axis.- Specified by:
getPrecedingSiblingAxisIteratorin interfaceorg.jaxen.Navigator- Overrides:
getPrecedingSiblingAxisIteratorin classorg.jaxen.DefaultNavigator- Parameters:
contextNode- the original context node- Returns:
- Returns an Iterator capable of traversing the axis, not null.
- Throws:
org.jaxen.UnsupportedAxisException- if the semantics of the preceding-sibling axis are not supported by this object model
-
getFollowingAxisIterator
public Iterator<?> getFollowingAxisIterator(Object contextNode) throws org.jaxen.UnsupportedAxisException Retrieves anIteratormatching thefollowingXPath axis.- Specified by:
getFollowingAxisIteratorin interfaceorg.jaxen.Navigator- Overrides:
getFollowingAxisIteratorin classorg.jaxen.DefaultNavigator- Parameters:
contextNode- the original context node- Returns:
- Returns an Iterator capable of traversing the axis, not null.
- Throws:
org.jaxen.UnsupportedAxisException- if the semantics of the following axis are not supported by this object model
-
getPrecedingAxisIterator
public Iterator<?> getPrecedingAxisIterator(Object contextNode) throws org.jaxen.UnsupportedAxisException Retrieves anIteratormatching theprecedingXPath axis.- Specified by:
getPrecedingAxisIteratorin interfaceorg.jaxen.Navigator- Overrides:
getPrecedingAxisIteratorin classorg.jaxen.DefaultNavigator- Parameters:
contextNode- the original context node- Returns:
- Returns an Iterator capable of traversing the axis, not null.
- Throws:
org.jaxen.UnsupportedAxisException- if the semantics of the preceding axis are not supported by this object model
-
getDocument
Loads a document from the given URI.- Specified by:
getDocumentin interfaceorg.jaxen.Navigator- Overrides:
getDocumentin classorg.jaxen.DefaultNavigator- Parameters:
uri- the URI of the document to load- Returns:
- Returns the document.
- Throws:
org.jaxen.FunctionCallException- if the document could not be loaded
-
getElementById
Returns the element whose ID is given by elementId. If no such element exists, returns null. Attributes with the name "ID" are not of type ID unless so defined. Implementations that do not know whether attributes are of type ID or not are expected to return null.- Specified by:
getElementByIdin interfaceorg.jaxen.Navigator- Overrides:
getElementByIdin classorg.jaxen.DefaultNavigator- Parameters:
contextNode- a node from the document in which to look for the idelementId- id to look for- Returns:
- Returns element whose ID is given by elementId, or null if no such element exists in the document or if the implementation does not know about attribute types.
-
getDocumentNode
Returns the document node that contains the given context node.- Specified by:
getDocumentNodein interfaceorg.jaxen.Navigator- Overrides:
getDocumentNodein classorg.jaxen.DefaultNavigator- Parameters:
contextNode- the context node- Returns:
- Returns the document of the context node.
- See Also:
-
translateNamespacePrefixToUri
Translates a namespace prefix to a namespace URI, possibly considering a particular element node.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.
- Specified by:
translateNamespacePrefixToUriin interfaceorg.jaxen.Navigator- Overrides:
translateNamespacePrefixToUriin classorg.jaxen.DefaultNavigator- Parameters:
prefix- the prefix to translateelement- the element to consider during translation- Returns:
- Returns the namespace URI associated with the prefix.
-
getProcessingInstructionTarget
Retrieves the target of a processing-instruction.- Specified by:
getProcessingInstructionTargetin interfaceorg.jaxen.Navigator- Overrides:
getProcessingInstructionTargetin classorg.jaxen.DefaultNavigator- Parameters:
object- the context processing-instruction node- Returns:
- Returns the target of the processing-instruction node.
-
getProcessingInstructionData
Retrieves the data of a processing-instruction.- Specified by:
getProcessingInstructionDatain interfaceorg.jaxen.Navigator- Overrides:
getProcessingInstructionDatain classorg.jaxen.DefaultNavigator- Parameters:
object- the context processing-instruction node- Returns:
- Returns the data of the processing-instruction node.
-
getNodeType
Returns a number that identifies the type of node that the given object represents in this navigator. See org.jaxen.pattern.Pattern- Specified by:
getNodeTypein interfaceorg.jaxen.Navigator- Overrides:
getNodeTypein classorg.jaxen.DefaultNavigator- Parameters:
node- ????- Returns:
- Returns short.
-
getParentNode
Returns the parent of the given context node.The parent of any node must either be a document node or an element node.
- Specified by:
getParentNodein interfaceorg.jaxen.Navigator- Overrides:
getParentNodein classorg.jaxen.DefaultNavigator- Parameters:
contextNode- the context node- Returns:
- Returns the parent of the context node, or null if this is a document node.
- Throws:
org.jaxen.UnsupportedAxisException- if the parent axis is not supported by the model- See Also:
-