org.jaxen.dom4j

Class DocumentNavigator

Implemented Interfaces:
NamedAccessNavigator, Navigator, Serializable

public class DocumentNavigator
extends DefaultNavigator
implements NamedAccessNavigator

Interface for navigating around the DOM4J object model.

This class is not intended for direct usage, but is used by the Jaxen engine during evaluation.

Authors:
bob mcwhirter
Stephen Colebourne
See Also:
XPath

Nested Class Summary

private static class
DocumentNavigator.Singleton
Singleton implementation.

Field Summary

private SAXReader
reader
private static long
serialVersionUID

Method Summary

Iterator
getAttributeAxisIterator(Object contextNode)
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)
String
getAttributeNamespaceUri(Object obj)
String
getAttributeQName(Object obj)
String
getAttributeStringValue(Object obj)
Iterator
getChildAxisIterator(Object contextNode)
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)
Object
getDocument(String uri)
Object
getDocumentNode(Object contextNode)
String
getElementName(Object obj)
String
getElementNamespaceUri(Object obj)
String
getElementQName(Object obj)
String
getElementStringValue(Object obj)
static Navigator
getInstance()
Retrieve the singleton instance of this DocumentNavigator.
Iterator
getNamespaceAxisIterator(Object contextNode)
String
getNamespacePrefix(Object obj)
String
getNamespaceStringValue(Object obj)
private String
getNodeStringValue(Node node)
short
getNodeType(Object node)
Iterator
getParentAxisIterator(Object contextNode)
Object
getParentNode(Object contextNode)
String
getProcessingInstructionData(Object obj)
String
getProcessingInstructionTarget(Object obj)
SAXReader
getSAXReader()
String
getTextStringValue(Object obj)
boolean
isAttribute(Object obj)
boolean
isComment(Object obj)
boolean
isDocument(Object obj)
boolean
isElement(Object obj)
boolean
isNamespace(Object obj)
boolean
isProcessingInstruction(Object obj)
boolean
isText(Object obj)
XPath
parseXPath(String xpath)
Returns a parsed form of the given XPath string, which will be suitable for queries on DOM4J documents.
void
setSAXReader(SAXReader reader)
String
translateNamespacePrefixToUri(String prefix, Object context)

Methods inherited from class org.jaxen.DefaultNavigator

getAncestorAxisIterator, getAncestorOrSelfAxisIterator, getAttributeAxisIterator, getChildAxisIterator, getDescendantAxisIterator, getDescendantOrSelfAxisIterator, getDocument, getDocumentNode, getElementById, getFollowingAxisIterator, getFollowingSiblingAxisIterator, getNamespaceAxisIterator, getNodeType, getParentAxisIterator, getParentNode, getPrecedingAxisIterator, getPrecedingSiblingAxisIterator, getProcessingInstructionData, getProcessingInstructionTarget, getSelfAxisIterator, translateNamespacePrefixToUri

Field Details

reader

private SAXReader reader

serialVersionUID

private static final long serialVersionUID
Field Value:
5582300797286535936L

Method Details

getAttributeAxisIterator

public Iterator getAttributeAxisIterator(Object contextNode)
Specified by:
getAttributeAxisIterator in interface Navigator
Overrides:
getAttributeAxisIterator in interface DefaultNavigator

getAttributeAxisIterator

public Iterator getAttributeAxisIterator(Object contextNode,
                                         String localName,
                                         String namespacePrefix,
                                         String namespaceURI)
Retrieves an Iterator over the attribute elements that match the supplied name.
Specified by:
getAttributeAxisIterator in interface NamedAccessNavigator
Parameters:
contextNode - the origin context node
localName - the local name of the attributes to return, always present
namespacePrefix - the prefix of the namespace of the attributes to return
namespaceURI - the URI of the namespace of the attributes to return
Returns:
an Iterator that traverses the named attributes, not null

getAttributeName

public String getAttributeName(Object obj)
Specified by:
getAttributeName in interface Navigator

getAttributeNamespaceUri

public String getAttributeNamespaceUri(Object obj)
Specified by:
getAttributeNamespaceUri in interface Navigator

getAttributeQName

public String getAttributeQName(Object obj)
Specified by:
getAttributeQName in interface Navigator

getAttributeStringValue

public String getAttributeStringValue(Object obj)
Specified by:
getAttributeStringValue in interface Navigator

getChildAxisIterator

public Iterator getChildAxisIterator(Object contextNode)
Specified by:
getChildAxisIterator in interface Navigator
Overrides:
getChildAxisIterator in interface DefaultNavigator

getChildAxisIterator

public Iterator getChildAxisIterator(Object contextNode,
                                     String localName,
                                     String namespacePrefix,
                                     String namespaceURI)
Retrieves an Iterator over the child elements that match the supplied name.
Specified by:
getChildAxisIterator in interface NamedAccessNavigator
Parameters:
contextNode - the origin context node
localName - the local name of the children to return, always present
namespacePrefix - the prefix of the namespace of the children to return
namespaceURI - the uri of the namespace of the children to return
Returns:
an Iterator that traverses the named children, or null if none

getCommentStringValue

public String getCommentStringValue(Object obj)
Specified by:
getCommentStringValue in interface Navigator

getDocument

public Object getDocument(String uri)
            throws FunctionCallException
Specified by:
getDocument in interface Navigator
Overrides:
getDocument in interface DefaultNavigator

getDocumentNode

public Object getDocumentNode(Object contextNode)
Specified by:
getDocumentNode in interface Navigator
Overrides:
getDocumentNode in interface DefaultNavigator

getElementName

public String getElementName(Object obj)
Specified by:
getElementName in interface Navigator

getElementNamespaceUri

public String getElementNamespaceUri(Object obj)
Specified by:
getElementNamespaceUri in interface Navigator

getElementQName

public String getElementQName(Object obj)
Specified by:
getElementQName in interface Navigator

getElementStringValue

public String getElementStringValue(Object obj)
Specified by:
getElementStringValue in interface Navigator

getInstance

public static Navigator getInstance()
Retrieve the singleton instance of this DocumentNavigator.

getNamespaceAxisIterator

public Iterator getNamespaceAxisIterator(Object contextNode)
Specified by:
getNamespaceAxisIterator in interface Navigator
Overrides:
getNamespaceAxisIterator in interface DefaultNavigator

getNamespacePrefix

public String getNamespacePrefix(Object obj)
Specified by:
getNamespacePrefix in interface Navigator

getNamespaceStringValue

public String getNamespaceStringValue(Object obj)
Specified by:
getNamespaceStringValue in interface Navigator

getNodeStringValue

private String getNodeStringValue(Node node)

getNodeType

public short getNodeType(Object node)
Specified by:
getNodeType in interface Navigator
Overrides:
getNodeType in interface DefaultNavigator

getParentAxisIterator

public Iterator getParentAxisIterator(Object contextNode)
Specified by:
getParentAxisIterator in interface Navigator
Overrides:
getParentAxisIterator in interface DefaultNavigator

getParentNode

public Object getParentNode(Object contextNode)
Specified by:
getParentNode in interface Navigator
Overrides:
getParentNode in interface DefaultNavigator

getProcessingInstructionData

public String getProcessingInstructionData(Object obj)
Specified by:
getProcessingInstructionData in interface Navigator
Overrides:
getProcessingInstructionData in interface DefaultNavigator

getProcessingInstructionTarget

public String getProcessingInstructionTarget(Object obj)
Specified by:
getProcessingInstructionTarget in interface Navigator
Overrides:
getProcessingInstructionTarget in interface DefaultNavigator

getSAXReader

public SAXReader getSAXReader()

getTextStringValue

public String getTextStringValue(Object obj)
Specified by:
getTextStringValue in interface Navigator

isAttribute

public boolean isAttribute(Object obj)
Specified by:
isAttribute in interface Navigator

isComment

public boolean isComment(Object obj)
Specified by:
isComment in interface Navigator

isDocument

public boolean isDocument(Object obj)
Specified by:
isDocument in interface Navigator

isElement

public boolean isElement(Object obj)
Specified by:
isElement in interface Navigator

isNamespace

public boolean isNamespace(Object obj)
Specified by:
isNamespace in interface Navigator

isProcessingInstruction

public boolean isProcessingInstruction(Object obj)
Specified by:
isProcessingInstruction in interface Navigator

isText

public boolean isText(Object obj)
Specified by:
isText in interface Navigator

parseXPath

public XPath parseXPath(String xpath)
            throws SAXPathException
Returns a parsed form of the given XPath string, which will be suitable for queries on DOM4J documents.
Specified by:
parseXPath in interface Navigator

setSAXReader

public void setSAXReader(SAXReader reader)

translateNamespacePrefixToUri

public String translateNamespacePrefixToUri(String prefix,
                                            Object context)
Specified by:
translateNamespacePrefixToUri in interface Navigator
Overrides:
translateNamespacePrefixToUri in interface DefaultNavigator