public class DocumentNavigator extends DefaultNavigator implements NamedAccessNavigator
This class is not intended for direct usage, but is used by the Jaxen engine during evaluation.
XPath
,
Serialized FormConstructor and Description |
---|
DocumentNavigator() |
Modifier and Type | Method and Description |
---|---|
Iterator |
getAttributeAxisIterator(Object contextNode)
Throws
UnsupportedAxisException . |
Iterator |
getAttributeAxisIterator(Object contextNode,
String localName,
String namespacePrefix,
String namespaceURI)
Retrieves an
Iterator over the attribute elements that
match the supplied name. |
String |
getAttributeName(Object obj)
Retrieve the local name of the given attribute node.
|
String |
getAttributeNamespaceUri(Object obj)
Retrieve the namespace URI of the given attribute node.
|
String |
getAttributeQName(Object obj)
Retrieve the qualified name of the given attribute node.
|
String |
getAttributeStringValue(Object obj)
Retrieve the string-value of an attribute node.
|
Iterator |
getChildAxisIterator(Object contextNode)
Throws
UnsupportedAxisException |
Iterator |
getChildAxisIterator(Object contextNode,
String localName,
String namespacePrefix,
String namespaceURI)
Retrieves an
Iterator over the child elements that
match the supplied name. |
String |
getCommentStringValue(Object obj)
Retrieve the string-value of a comment node.
|
Object |
getDocument(String uri)
Default implementation that always returns null.
|
Object |
getDocumentNode(Object contextNode)
Returns the document node that contains the given context node.
|
String |
getElementName(Object obj)
Retrieve the local name of the given element node.
|
String |
getElementNamespaceUri(Object obj)
Retrieve the namespace URI of the given element node.
|
String |
getElementQName(Object obj)
Retrieve the qualified name of the given element node.
|
String |
getElementStringValue(Object obj)
Retrieve the string-value of an element node.
|
static Navigator |
getInstance()
Retrieve the singleton instance of this
DocumentNavigator . |
Iterator |
getNamespaceAxisIterator(Object contextNode)
Throws
UnsupportedAxisException . |
String |
getNamespacePrefix(Object obj)
Retrieve the namespace prefix of a namespace node.
|
String |
getNamespaceStringValue(Object obj)
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)
Throws
UnsupportedAxisException |
Object |
getParentNode(Object contextNode)
Default inefficient implementation.
|
String |
getProcessingInstructionData(Object obj)
Retrieve the data of a processing-instruction.
|
String |
getProcessingInstructionTarget(Object obj)
Retrieve the target of a processing-instruction.
|
org.dom4j.io.SAXReader |
getSAXReader() |
String |
getTextStringValue(Object obj)
Retrieve the string-value of a text node.
|
boolean |
isAttribute(Object obj)
Returns whether the given object is an attribute node.
|
boolean |
isComment(Object obj)
Returns whether the given object is a comment node.
|
boolean |
isDocument(Object obj)
Returns whether the given object is a document node.
|
boolean |
isElement(Object obj)
Returns whether the given object is an element node.
|
boolean |
isNamespace(Object obj)
Returns whether the given object is a namespace node.
|
boolean |
isProcessingInstruction(Object obj)
Returns whether the given object is a processing-instruction node.
|
boolean |
isText(Object obj)
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 DOM4J documents.
|
void |
setSAXReader(org.dom4j.io.SAXReader reader) |
String |
translateNamespacePrefixToUri(String prefix,
Object context)
Translate a namespace prefix to a namespace URI, possibly
considering a particular element node.
|
getAncestorAxisIterator, getAncestorOrSelfAxisIterator, getDescendantAxisIterator, getDescendantOrSelfAxisIterator, getElementById, getFollowingAxisIterator, getFollowingSiblingAxisIterator, getPrecedingAxisIterator, getPrecedingSiblingAxisIterator, getSelfAxisIterator
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAncestorAxisIterator, getAncestorOrSelfAxisIterator, getDescendantAxisIterator, getDescendantOrSelfAxisIterator, getElementById, getFollowingAxisIterator, getFollowingSiblingAxisIterator, getPrecedingAxisIterator, getPrecedingSiblingAxisIterator, getSelfAxisIterator
public static Navigator getInstance()
DocumentNavigator
.public boolean isElement(Object obj)
Navigator
public boolean isComment(Object obj)
Navigator
public boolean isText(Object obj)
Navigator
public boolean isAttribute(Object obj)
Navigator
isAttribute
in interface Navigator
obj
- the object to testtrue
if the object is an attribute node,
else false
public boolean isProcessingInstruction(Object obj)
Navigator
isProcessingInstruction
in interface Navigator
obj
- the object to testtrue
if the object is a processing-instruction node,
else false
public boolean isDocument(Object obj)
Navigator
/
.isDocument
in interface Navigator
obj
- the object to testtrue
if the object is a document node,
else false
public boolean isNamespace(Object obj)
Navigator
isNamespace
in interface Navigator
obj
- the object to testtrue
if the object is a namespace node,
else false
public String getElementName(Object obj)
Navigator
getElementName
in interface Navigator
obj
- the context element nodepublic String getElementNamespaceUri(Object obj)
Navigator
getElementNamespaceUri
in interface Navigator
obj
- the context element nodepublic String getElementQName(Object obj)
Navigator
getElementQName
in interface Navigator
obj
- the context element nodepublic String getAttributeName(Object obj)
Navigator
getAttributeName
in interface Navigator
obj
- the context attribute nodepublic String getAttributeNamespaceUri(Object obj)
Navigator
getAttributeNamespaceUri
in interface Navigator
obj
- the context attribute nodepublic String getAttributeQName(Object obj)
Navigator
getAttributeQName
in interface Navigator
obj
- the context attribute nodepublic Iterator getChildAxisIterator(Object contextNode)
DefaultNavigator
UnsupportedAxisException
getChildAxisIterator
in interface Navigator
getChildAxisIterator
in class DefaultNavigator
contextNode
- the original context nodepublic Iterator getChildAxisIterator(Object contextNode, String localName, String namespacePrefix, String namespaceURI)
Iterator
over the child elements that
match the supplied name.getChildAxisIterator
in interface NamedAccessNavigator
contextNode
- the origin context nodelocalName
- the local name of the children to return, always presentnamespacePrefix
- the prefix of the namespace of the children to returnnamespaceURI
- the uri of the namespace of the children to returnpublic Iterator getParentAxisIterator(Object contextNode)
DefaultNavigator
UnsupportedAxisException
getParentAxisIterator
in interface Navigator
getParentAxisIterator
in class DefaultNavigator
contextNode
- the original context nodepublic Iterator getAttributeAxisIterator(Object contextNode)
DefaultNavigator
UnsupportedAxisException
. Subclasses that
support the attribute axis must override this method.getAttributeAxisIterator
in interface Navigator
getAttributeAxisIterator
in class DefaultNavigator
contextNode
- the original context nodepublic Iterator getAttributeAxisIterator(Object contextNode, String localName, String namespacePrefix, String namespaceURI)
Iterator
over the attribute elements that
match the supplied name.getAttributeAxisIterator
in interface NamedAccessNavigator
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 returnpublic Iterator getNamespaceAxisIterator(Object contextNode)
DefaultNavigator
UnsupportedAxisException
. Subclasses that
support the namespace axis must override this method.getNamespaceAxisIterator
in interface Navigator
getNamespaceAxisIterator
in class DefaultNavigator
contextNode
- the original context nodepublic Object getDocumentNode(Object contextNode)
Navigator
getDocumentNode
in interface Navigator
getDocumentNode
in class DefaultNavigator
contextNode
- the context nodeNavigator.isDocument(Object)
public XPath parseXPath(String xpath) throws SAXPathException
parseXPath
in interface Navigator
xpath
- the XPath expressionSAXPathException
- if the string is not a syntactically
correct XPath expressionXPath
public Object getParentNode(Object contextNode)
DefaultNavigator
getParentNode
in interface Navigator
getParentNode
in class DefaultNavigator
contextNode
- the node whose parent to returnNavigator.isDocument(java.lang.Object)
,
Navigator.isElement(java.lang.Object)
public String getTextStringValue(Object obj)
Navigator
getTextStringValue
in interface Navigator
obj
- the text nodepublic String getElementStringValue(Object obj)
Navigator
getElementStringValue
in interface Navigator
obj
- the comment node.public String getAttributeStringValue(Object obj)
Navigator
getAttributeStringValue
in interface Navigator
obj
- the attribute nodepublic String getNamespaceStringValue(Object obj)
Navigator
getNamespaceStringValue
in interface Navigator
obj
- the namespace nodepublic String getNamespacePrefix(Object obj)
Navigator
getNamespacePrefix
in interface Navigator
obj
- the namespace nodepublic String getCommentStringValue(Object obj)
Navigator
getCommentStringValue
in interface Navigator
obj
- the comment nodepublic String translateNamespacePrefixToUri(String prefix, Object context)
Navigator
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.
translateNamespacePrefixToUri
in interface Navigator
translateNamespacePrefixToUri
in class DefaultNavigator
prefix
- the prefix to translatecontext
- the element to consider during translationNamespaceContext
public short getNodeType(Object node)
Navigator
getNodeType
in interface Navigator
getNodeType
in class DefaultNavigator
node
- ????Pattern
public Object getDocument(String uri) throws FunctionCallException
DefaultNavigator
getDocument
in interface Navigator
getDocument
in class DefaultNavigator
uri
- the URL of the document to loadFunctionCallException
- if an error occurs while loading the
URL; e.g. an I/O error or the document is malformedpublic String getProcessingInstructionTarget(Object obj)
Navigator
getProcessingInstructionTarget
in interface Navigator
getProcessingInstructionTarget
in class DefaultNavigator
obj
- the context processing-instruction nodepublic String getProcessingInstructionData(Object obj)
Navigator
getProcessingInstructionData
in interface Navigator
getProcessingInstructionData
in class DefaultNavigator
obj
- the context processing-instruction nodepublic org.dom4j.io.SAXReader getSAXReader()
public void setSAXReader(org.dom4j.io.SAXReader reader)
Copyright © 2001–2015 Codehaus. All rights reserved.