Class DocumentNavigator
java.lang.Object
org.jaxen.DefaultNavigator
org.jaxen.jdom.DocumentNavigator
- All Implemented Interfaces:
Serializable, NamedAccessNavigator, Navigator
Interface for navigating around the JDOM object model.
This class is not intended for direct usage, but is used by the Jaxen engine during evaluation.
- Author:
- bob mcwhirter, Stephen Colebourne
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAttributeAxisIterator(Object contextNode) Retrieve anIteratormatching theattributeXPath axis.getAttributeAxisIterator(Object contextNode, String localName, String namespacePrefix, String namespaceURI) Retrieves anIteratorover the attribute elements that match the supplied name.getAttributeName(Object obj) Retrieve the local name of the given attribute node.Retrieve the namespace URI of the given attribute node.getAttributeQName(Object obj) Retrieve the qualified name of the given attribute node.Retrieve the string-value of an attribute node.getChildAxisIterator(Object contextNode) ThrowsUnsupportedAxisException.getChildAxisIterator(Object contextNode, String localName, String namespacePrefix, String namespaceURI) Retrieves anIteratorover the child elements that match the supplied local name and namespace URI.Retrieve the string-value of a comment node.getDocument(String url) Default implementation that always returns null.getDocumentNode(Object contextNode) Returns null.getElementName(Object obj) Retrieve the local name of the given element node.Retrieve the namespace URI of the given element node.getElementQName(Object obj) Retrieve the qualified name of the given element node.Retrieve the string-value of an element node.static NavigatorgetNamespaceAxisIterator(Object contextNode) ThrowsUnsupportedAxisException.getNamespacePrefix(Object obj) Retrieve the namespace prefix of a namespace node.Retrieve the string-value of a namespace node.getParentAxisIterator(Object contextNode) ThrowsUnsupportedAxisException.Returns null.Returns null.getTextStringValue(Object obj) Retrieve the string-value of a text node.booleanisAttribute(Object obj) Returns whether the given object is an attribute node.booleanReturns whether the given object is a comment node.booleanisDocument(Object obj) Returns whether the given object is a document node.booleanReturns whether the given object is an element node.booleanisNamespace(Object obj) Returns whether the given object is a namespace node.booleanReturns whether the given object is a processing-instruction node.booleanReturns whether the given object is a text node.parseXPath(String xpath) Returns a parsed form of the given XPath string, which will be suitable for queries on JDOM documents.translateNamespacePrefixToUri(String prefix, Object context) Returns null.Methods inherited from class DefaultNavigator
getAncestorAxisIterator, getAncestorOrSelfAxisIterator, getDescendantAxisIterator, getDescendantOrSelfAxisIterator, getElementById, getFollowingAxisIterator, getFollowingSiblingAxisIterator, getNodeType, getParentNode, getPrecedingAxisIterator, getPrecedingSiblingAxisIterator, getSelfAxisIteratorMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Navigator
getAncestorAxisIterator, getAncestorOrSelfAxisIterator, getDescendantAxisIterator, getDescendantOrSelfAxisIterator, getElementById, getFollowingAxisIterator, getFollowingSiblingAxisIterator, getNodeType, getParentNode, getPrecedingAxisIterator, getPrecedingSiblingAxisIterator, getSelfAxisIterator
-
Constructor Details
-
DocumentNavigator
public DocumentNavigator()
-
-
Method Details
-
getInstance
-
isElement
-
isComment
-
isText
-
isAttribute
Description copied from interface:NavigatorReturns whether the given object is an attribute node.- Specified by:
isAttributein interfaceNavigator- Parameters:
obj- the object to test- Returns:
trueif the object is an attribute node, elsefalse
-
isProcessingInstruction
Description copied from interface:NavigatorReturns whether the given object is a processing-instruction node.- Specified by:
isProcessingInstructionin interfaceNavigator- Parameters:
obj- the object to test- Returns:
trueif the object is a processing-instruction node, elsefalse
-
isDocument
Description copied from interface:NavigatorReturns whether the given object is a document node. A document node is the node that is selected by the XPath expression/.- Specified by:
isDocumentin interfaceNavigator- Parameters:
obj- the object to test- Returns:
trueif the object is a document node, elsefalse
-
isNamespace
Description copied from interface:NavigatorReturns whether the given object is a namespace node.- Specified by:
isNamespacein interfaceNavigator- Parameters:
obj- the object to test- Returns:
trueif the object is a namespace node, elsefalse
-
getElementName
Description copied from interface:NavigatorRetrieve the local name of the given element node.- Specified by:
getElementNamein interfaceNavigator- Parameters:
obj- the context element node- Returns:
- the local name of the element node
-
getElementNamespaceUri
Description copied from interface:NavigatorRetrieve the namespace URI of the given element node.- Specified by:
getElementNamespaceUriin interfaceNavigator- Parameters:
obj- the context element node- Returns:
- the namespace URI of the element node
-
getAttributeName
Description copied from interface:NavigatorRetrieve the local name of the given attribute node.- Specified by:
getAttributeNamein interfaceNavigator- Parameters:
obj- the context attribute node- Returns:
- the local name of the attribute node
-
getAttributeNamespaceUri
Description copied from interface:NavigatorRetrieve the namespace URI of the given attribute node.- Specified by:
getAttributeNamespaceUriin interfaceNavigator- Parameters:
obj- the context attribute node- Returns:
- the namespace URI of the attribute node
-
getChildAxisIterator
Description copied from class:DefaultNavigatorThrowsUnsupportedAxisException. Subclasses should override this method.- Specified by:
getChildAxisIteratorin interfaceNavigator- Overrides:
getChildAxisIteratorin classDefaultNavigator- Parameters:
contextNode- the node to start from- Returns:
- never returns
-
getChildAxisIterator
public Iterator getChildAxisIterator(Object contextNode, String localName, String namespacePrefix, String namespaceURI) Retrieves anIteratorover the child elements that match the supplied local name and namespace URI.- Specified by:
getChildAxisIteratorin interfaceNamedAccessNavigator- Parameters:
contextNode- the origin context nodelocalName- the local name of the children to return, always presentnamespacePrefix- ignored; prefixes are not used when matching in XPathnamespaceURI- the URI of the namespace of the children to return- Returns:
- an Iterator that traverses the named children, or null if none
-
getNamespaceAxisIterator
Description copied from class:DefaultNavigatorThrowsUnsupportedAxisException. Subclasses that support the namespace axis must override this method.- Specified by:
getNamespaceAxisIteratorin interfaceNavigator- Overrides:
getNamespaceAxisIteratorin classDefaultNavigator- Parameters:
contextNode- the node to start from- Returns:
- never returns
-
getParentAxisIterator
Description copied from class:DefaultNavigatorThrowsUnsupportedAxisException. Subclasses should override this method.- Specified by:
getParentAxisIteratorin interfaceNavigator- Overrides:
getParentAxisIteratorin classDefaultNavigator- Parameters:
contextNode- the node to start from- Returns:
- never returns
-
getAttributeAxisIterator
Description copied from class:DefaultNavigatorRetrieve anIteratormatching theattributeXPath axis.- Specified by:
getAttributeAxisIteratorin interfaceNavigator- Overrides:
getAttributeAxisIteratorin classDefaultNavigator- Parameters:
contextNode- the original context node- Returns:
- an Iterator capable of traversing the axis, not null
-
getAttributeAxisIterator
public Iterator getAttributeAxisIterator(Object contextNode, String localName, String namespacePrefix, String namespaceURI) Retrieves anIteratorover the attribute elements that match the supplied name.- Specified by:
getAttributeAxisIteratorin interfaceNamedAccessNavigator- Parameters:
contextNode- the origin context nodelocalName- the local name of the attributes to return, always presentnamespacePrefix- the prefix of the namespace of the attributes to returnnamespaceURI- the URI of the namespace of the attributes to return- Returns:
- an Iterator that traverses the named attributes, not null
-
parseXPath
Returns a parsed form of the given XPath string, which will be suitable for queries on JDOM documents.- Specified by:
parseXPathin interfaceNavigator- Parameters:
xpath- the XPath expression- Returns:
- a new XPath expression object
- Throws:
SAXPathException- if the string is not a syntactically correct XPath expression- See Also:
-
getDocumentNode
Description copied from class:DefaultNavigatorReturns null.- Specified by:
getDocumentNodein interfaceNavigator- Overrides:
getDocumentNodein classDefaultNavigator- Parameters:
contextNode- the node to start from- Returns:
- null
- See Also:
-
getElementQName
Description copied from interface:NavigatorRetrieve the qualified name of the given element node.- Specified by:
getElementQNamein interfaceNavigator- Parameters:
obj- the context element node- Returns:
- the qualified name of the element node
-
getAttributeQName
Description copied from interface:NavigatorRetrieve the qualified name of the given attribute node.- Specified by:
getAttributeQNamein interfaceNavigator- Parameters:
obj- the context attribute node- Returns:
- the qualified name of the attribute node
-
getNamespaceStringValue
Description copied from interface:NavigatorRetrieve the string-value of a namespace node. This is generally the namespace URI. This may be the empty string but must not be null.- Specified by:
getNamespaceStringValuein interfaceNavigator- Parameters:
obj- the namespace node- Returns:
- the string-value of the node
-
getNamespacePrefix
Description copied from interface:NavigatorRetrieve the namespace prefix of a namespace node.- Specified by:
getNamespacePrefixin interfaceNavigator- Parameters:
obj- the namespace node- Returns:
- the prefix associated with the node
-
getTextStringValue
Description copied from interface:NavigatorRetrieve 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.- Specified by:
getTextStringValuein interfaceNavigator- Parameters:
obj- the text node- Returns:
- the string-value of the node
-
getAttributeStringValue
Description copied from interface:NavigatorRetrieve 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.- Specified by:
getAttributeStringValuein interfaceNavigator- Parameters:
obj- the attribute node- Returns:
- the string-value of the node
-
getElementStringValue
Description copied from interface:NavigatorRetrieve the string-value of an element node. This may be the empty string if the element is empty, but must not be null.- Specified by:
getElementStringValuein interfaceNavigator- Parameters:
obj- the comment node.- Returns:
- the string-value of the node.
-
getProcessingInstructionTarget
Description copied from class:DefaultNavigatorReturns null.- Specified by:
getProcessingInstructionTargetin interfaceNavigator- Overrides:
getProcessingInstructionTargetin classDefaultNavigator- Parameters:
obj- the node to start from- Returns:
- null
-
getProcessingInstructionData
Description copied from class:DefaultNavigatorReturns null.- Specified by:
getProcessingInstructionDatain interfaceNavigator- Overrides:
getProcessingInstructionDatain classDefaultNavigator- Parameters:
obj- the node to start from- Returns:
- null
-
getCommentStringValue
Description copied from interface:NavigatorRetrieve the string-value of a comment node. This may be the empty string if the comment is empty, but must not be null.- Specified by:
getCommentStringValuein interfaceNavigator- Parameters:
obj- the comment node- Returns:
- the string-value of the node
-
translateNamespacePrefixToUri
Description copied from class:DefaultNavigatorReturns null.- Specified by:
translateNamespacePrefixToUriin interfaceNavigator- Overrides:
translateNamespacePrefixToUriin classDefaultNavigator- Parameters:
prefix- the prefix to translatecontext- the node to start from- Returns:
- null
- See Also:
-
getDocument
Description copied from class:DefaultNavigatorDefault implementation that always returns null. Override in subclass if the subclass can load documents.- Specified by:
getDocumentin interfaceNavigator- Overrides:
getDocumentin classDefaultNavigator- Parameters:
url- the URL of the document to load- Returns:
- null
- Throws:
FunctionCallException- if an error occurs while loading the URL; e.g. an I/O error or the document is malformed
-