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 Form| Modifier and Type | Class and Description |
|---|---|
private static class |
DocumentNavigator.Singleton
Singleton implementation.
|
| Modifier and Type | Field and Description |
|---|---|
private static long |
serialVersionUID |
| Constructor and Description |
|---|
DocumentNavigator() |
| Modifier and Type | Method and Description |
|---|---|
java.util.Iterator |
getAttributeAxisIterator(java.lang.Object contextNode)
Throws
UnsupportedAxisException. |
java.util.Iterator |
getAttributeAxisIterator(java.lang.Object contextNode,
java.lang.String localName,
java.lang.String namespacePrefix,
java.lang.String namespaceURI)
Retrieves an
Iterator over the attribute elements that
match the supplied name. |
java.lang.String |
getAttributeName(java.lang.Object obj)
Retrieve the local name of the given attribute node.
|
java.lang.String |
getAttributeNamespaceUri(java.lang.Object obj)
Retrieve the namespace URI of the given attribute node.
|
java.lang.String |
getAttributeQName(java.lang.Object obj)
Retrieve the qualified name of the given attribute node.
|
java.lang.String |
getAttributeStringValue(java.lang.Object obj)
Retrieve the string-value of an attribute node.
|
java.util.Iterator |
getChildAxisIterator(java.lang.Object contextNode)
Throws
UnsupportedAxisException |
java.util.Iterator |
getChildAxisIterator(java.lang.Object contextNode,
java.lang.String localName,
java.lang.String namespacePrefix,
java.lang.String namespaceURI)
Retrieves an
Iterator over the child elements that
match the supplied local name and namespace URI. |
java.lang.String |
getCommentStringValue(java.lang.Object obj)
Retrieve the string-value of a comment node.
|
java.lang.Object |
getDocument(java.lang.String url)
Default implementation that always returns null.
|
java.lang.Object |
getDocumentNode(java.lang.Object contextNode)
Returns the document node that contains the given context node.
|
java.lang.String |
getElementName(java.lang.Object obj)
Retrieve the local name of the given element node.
|
java.lang.String |
getElementNamespaceUri(java.lang.Object obj)
Retrieve the namespace URI of the given element node.
|
java.lang.String |
getElementQName(java.lang.Object obj)
Retrieve the qualified name of the given element node.
|
java.lang.String |
getElementStringValue(java.lang.Object obj)
Retrieve the string-value of an element node.
|
static Navigator |
getInstance() |
java.util.Iterator |
getNamespaceAxisIterator(java.lang.Object contextNode)
Throws
UnsupportedAxisException. |
java.lang.String |
getNamespacePrefix(java.lang.Object obj)
Retrieve the namespace prefix of a namespace node.
|
java.lang.String |
getNamespaceStringValue(java.lang.Object obj)
Retrieve the string-value of a namespace node.
|
java.util.Iterator |
getParentAxisIterator(java.lang.Object contextNode)
Throws
UnsupportedAxisException |
java.lang.String |
getProcessingInstructionData(java.lang.Object obj)
Retrieve the data of a processing-instruction.
|
java.lang.String |
getProcessingInstructionTarget(java.lang.Object obj)
Retrieve the target of a processing-instruction.
|
java.lang.String |
getTextStringValue(java.lang.Object obj)
Retrieve the string-value of a text node.
|
boolean |
isAttribute(java.lang.Object obj)
Returns whether the given object is an attribute node.
|
boolean |
isComment(java.lang.Object obj)
Returns whether the given object is a comment node.
|
boolean |
isDocument(java.lang.Object obj)
Returns whether the given object is a document node.
|
boolean |
isElement(java.lang.Object obj)
Returns whether the given object is an element node.
|
boolean |
isNamespace(java.lang.Object obj)
Returns whether the given object is a namespace node.
|
boolean |
isProcessingInstruction(java.lang.Object obj)
Returns whether the given object is a processing-instruction node.
|
boolean |
isText(java.lang.Object obj)
Returns whether the given object is a text node.
|
XPath |
parseXPath(java.lang.String xpath)
Returns a parsed form of the given XPath string, which will be suitable
for queries on JDOM documents.
|
java.lang.String |
translateNamespacePrefixToUri(java.lang.String prefix,
java.lang.Object context)
Translate a namespace prefix to a namespace URI, possibly
considering a particular element node.
|
getAncestorAxisIterator, getAncestorOrSelfAxisIterator, getDescendantAxisIterator, getDescendantOrSelfAxisIterator, getElementById, getFollowingAxisIterator, getFollowingSiblingAxisIterator, getNodeType, getParentNode, getPrecedingAxisIterator, getPrecedingSiblingAxisIterator, getSelfAxisIteratorclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetAncestorAxisIterator, getAncestorOrSelfAxisIterator, getDescendantAxisIterator, getDescendantOrSelfAxisIterator, getElementById, getFollowingAxisIterator, getFollowingSiblingAxisIterator, getNodeType, getParentNode, getPrecedingAxisIterator, getPrecedingSiblingAxisIterator, getSelfAxisIteratorprivate static final long serialVersionUID
public static Navigator getInstance()
public boolean isElement(java.lang.Object obj)
Navigatorpublic boolean isComment(java.lang.Object obj)
Navigatorpublic boolean isText(java.lang.Object obj)
Navigatorpublic boolean isAttribute(java.lang.Object obj)
NavigatorisAttribute in interface Navigatorobj - the object to testtrue if the object is an attribute node,
else falsepublic boolean isProcessingInstruction(java.lang.Object obj)
NavigatorisProcessingInstruction in interface Navigatorobj - the object to testtrue if the object is a processing-instruction node,
else falsepublic boolean isDocument(java.lang.Object obj)
Navigator/.isDocument in interface Navigatorobj - the object to testtrue if the object is a document node,
else falsepublic boolean isNamespace(java.lang.Object obj)
NavigatorisNamespace in interface Navigatorobj - the object to testtrue if the object is a namespace node,
else falsepublic java.lang.String getElementName(java.lang.Object obj)
NavigatorgetElementName in interface Navigatorobj - the context element nodepublic java.lang.String getElementNamespaceUri(java.lang.Object obj)
NavigatorgetElementNamespaceUri in interface Navigatorobj - the context element nodepublic java.lang.String getAttributeName(java.lang.Object obj)
NavigatorgetAttributeName in interface Navigatorobj - the context attribute nodepublic java.lang.String getAttributeNamespaceUri(java.lang.Object obj)
NavigatorgetAttributeNamespaceUri in interface Navigatorobj - the context attribute nodepublic java.util.Iterator getChildAxisIterator(java.lang.Object contextNode)
DefaultNavigatorUnsupportedAxisExceptiongetChildAxisIterator in interface NavigatorgetChildAxisIterator in class DefaultNavigatorcontextNode - the original context nodepublic java.util.Iterator getChildAxisIterator(java.lang.Object contextNode,
java.lang.String localName,
java.lang.String namespacePrefix,
java.lang.String namespaceURI)
Iterator over the child elements that
match the supplied local name and namespace URI.getChildAxisIterator in interface NamedAccessNavigatorcontextNode - 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 returnpublic java.util.Iterator getNamespaceAxisIterator(java.lang.Object contextNode)
DefaultNavigatorUnsupportedAxisException. Subclasses that
support the namespace axis must override this method.getNamespaceAxisIterator in interface NavigatorgetNamespaceAxisIterator in class DefaultNavigatorcontextNode - the original context nodepublic java.util.Iterator getParentAxisIterator(java.lang.Object contextNode)
DefaultNavigatorUnsupportedAxisExceptiongetParentAxisIterator in interface NavigatorgetParentAxisIterator in class DefaultNavigatorcontextNode - the original context nodepublic java.util.Iterator getAttributeAxisIterator(java.lang.Object contextNode)
DefaultNavigatorUnsupportedAxisException. Subclasses that
support the attribute axis must override this method.getAttributeAxisIterator in interface NavigatorgetAttributeAxisIterator in class DefaultNavigatorcontextNode - the original context nodepublic java.util.Iterator getAttributeAxisIterator(java.lang.Object contextNode,
java.lang.String localName,
java.lang.String namespacePrefix,
java.lang.String namespaceURI)
Iterator over the attribute elements that
match the supplied name.getAttributeAxisIterator in interface NamedAccessNavigatorcontextNode - 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 XPath parseXPath(java.lang.String xpath) throws SAXPathException
parseXPath in interface Navigatorxpath - the XPath expressionSAXPathException - if the string is not a syntactically
correct XPath expressionXPathpublic java.lang.Object getDocumentNode(java.lang.Object contextNode)
NavigatorgetDocumentNode in interface NavigatorgetDocumentNode in class DefaultNavigatorcontextNode - the context nodeNavigator.isDocument(Object)public java.lang.String getElementQName(java.lang.Object obj)
NavigatorgetElementQName in interface Navigatorobj - the context element nodepublic java.lang.String getAttributeQName(java.lang.Object obj)
NavigatorgetAttributeQName in interface Navigatorobj - the context attribute nodepublic java.lang.String getNamespaceStringValue(java.lang.Object obj)
NavigatorgetNamespaceStringValue in interface Navigatorobj - the namespace nodepublic java.lang.String getNamespacePrefix(java.lang.Object obj)
NavigatorgetNamespacePrefix in interface Navigatorobj - the namespace nodepublic java.lang.String getTextStringValue(java.lang.Object obj)
NavigatorgetTextStringValue in interface Navigatorobj - the text nodepublic java.lang.String getAttributeStringValue(java.lang.Object obj)
NavigatorgetAttributeStringValue in interface Navigatorobj - the attribute nodepublic java.lang.String getElementStringValue(java.lang.Object obj)
NavigatorgetElementStringValue in interface Navigatorobj - the comment node.public java.lang.String getProcessingInstructionTarget(java.lang.Object obj)
NavigatorgetProcessingInstructionTarget in interface NavigatorgetProcessingInstructionTarget in class DefaultNavigatorobj - the context processing-instruction nodepublic java.lang.String getProcessingInstructionData(java.lang.Object obj)
NavigatorgetProcessingInstructionData in interface NavigatorgetProcessingInstructionData in class DefaultNavigatorobj - the context processing-instruction nodepublic java.lang.String getCommentStringValue(java.lang.Object obj)
NavigatorgetCommentStringValue in interface Navigatorobj - the comment nodepublic java.lang.String translateNamespacePrefixToUri(java.lang.String prefix,
java.lang.Object context)
NavigatorStrictly 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 NavigatortranslateNamespacePrefixToUri in class DefaultNavigatorprefix - the prefix to translatecontext - the element to consider during translationNamespaceContextpublic java.lang.Object getDocument(java.lang.String url)
throws FunctionCallException
DefaultNavigatorgetDocument in interface NavigatorgetDocument in class DefaultNavigatorurl - 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 malformed