|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.jaxen.DefaultNavigator | +--org.jaxen.dom.DocumentNavigator
Interface for navigating around the W3C DOM Level 2 object model.
This class is not intended for direct usage, but is used by the Jaxen engine during evaluation.
This class implements the org.jaxen.DefaultNavigator interface for the Jaxen XPath library, version 1.0beta3 (it is not guaranteed to work with subsequent releases). This adapter allows the Jaxen library to be used to execute XPath queries against any object tree that implements the DOM level 2 interfaces.
Note: DOM level 2 does not include a node representing an XML
Namespace declaration. This navigator will return Namespace decls
as instantiations of the custom NamespaceNode
class, and
users will have to check result sets to locate and isolate
these.
XPath
,
NamespaceNode
, Serialized FormConstructor Summary | |
DocumentNavigator()
Default Constructor. |
Method Summary | |
Iterator |
getAttributeAxisIterator(Object contextNode)
Get an iterator over all attributes. |
String |
getAttributeName(Object object)
Get the local name of an attribute. |
String |
getAttributeNamespaceUri(Object object)
Get the Namespace URI of an attribute. |
String |
getAttributeQName(Object object)
Get the qualified name of an attribute. |
String |
getAttributeStringValue(Object object)
Get the string value of an attribute node. |
Iterator |
getChildAxisIterator(Object contextNode)
Get an iterator over all of this node's children. |
String |
getCommentStringValue(Object object)
Get the string value of a comment node. |
Object |
getDocument(String uri)
Use JAXP to load a namespace aware document from a given URI |
Object |
getDocumentNode(Object contextNode)
Get the top-level document node. |
Object |
getElementById(Object object,
String elementId)
Returns the element whose ID is given by elementId. |
String |
getElementName(Object object)
Get the local name of an element. |
String |
getElementNamespaceUri(Object object)
Get the Namespace URI of an element. |
String |
getElementQName(Object object)
Get the qualified name of an element. |
String |
getElementStringValue(Object object)
Get the string value of an element node. |
Iterator |
getFollowingAxisIterator(Object contextNode)
Get an iterator over all following nodes, depth-first. |
Iterator |
getFollowingSiblingAxisIterator(Object contextNode)
Get an iterator over all following siblings. |
static DocumentNavigator |
getInstance()
Get a singleton DocumentNavigator for efficiency. |
Iterator |
getNamespaceAxisIterator(Object contextNode)
Get an iterator over all declared Namespaces. |
String |
getNamespacePrefix(Object object)
Get the prefix value of a Namespace node. |
String |
getNamespaceStringValue(Object object)
Get the string value of a Namespace node. |
Iterator |
getParentAxisIterator(Object contextNode)
Get a (single-member) iterator over this node's parent. |
Iterator |
getPrecedingAxisIterator(Object contextNode)
Get an iterator over all preceding nodes, depth-first. |
Iterator |
getPrecedingSiblingAxisIterator(Object contextNode)
Get an iterator over all preceding siblings. |
String |
getProcessingInstructionData(Object obj)
Retrieve the data of a processing-instruction. |
String |
getProcessingInstructionTarget(Object obj)
Retrieve the target of a processing-instruction. |
String |
getTextStringValue(Object object)
Get the string value of text. |
boolean |
isAttribute(Object object)
Test if a node is an attribute. |
boolean |
isComment(Object object)
Test if a node is a comment. |
boolean |
isDocument(Object object)
Test if a node is a top-level document. |
boolean |
isElement(Object object)
Test if a node is an element. |
boolean |
isNamespace(Object object)
Test if a node is a Namespace. |
boolean |
isProcessingInstruction(Object object)
Test if a node is a processing instruction. |
boolean |
isText(Object object)
Test if a node is plain text. |
XPath |
parseXPath(String xpath)
Returns a parsed form of the given xpath string, which will be suitable for queries on DOM documents. |
String |
translateNamespacePrefixToUri(String prefix,
Object element)
Translate a Namespace prefix to a URI. |
Methods inherited from class org.jaxen.DefaultNavigator |
getAncestorAxisIterator, getAncestorOrSelfAxisIterator, getDescendantAxisIterator, getDescendantOrSelfAxisIterator, getNodeType, getParentNode, getSelfAxisIterator |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DocumentNavigator()
Method Detail |
public static DocumentNavigator getInstance()
public Iterator getChildAxisIterator(Object contextNode)
getChildAxisIterator
in class DefaultNavigator
contextNode
- The context node for the child axis.public Iterator getParentAxisIterator(Object contextNode)
getParentAxisIterator
in class DefaultNavigator
contextNode
- the context node for the parent axis.public Iterator getFollowingSiblingAxisIterator(Object contextNode)
getFollowingSiblingAxisIterator
in class DefaultNavigator
contextNode
- the context node for the sibling iterator.public Iterator getPrecedingSiblingAxisIterator(Object contextNode)
getPrecedingSiblingAxisIterator
in class DefaultNavigator
contextNode
- The context node for the preceding sibling axis.public Iterator getFollowingAxisIterator(Object contextNode)
getFollowingAxisIterator
in class DefaultNavigator
contextNode
- The context node for the following axis.public Iterator getPrecedingAxisIterator(Object contextNode)
getPrecedingAxisIterator
in class DefaultNavigator
contextNode
- The context node for the preceding axis.public Iterator getAttributeAxisIterator(Object contextNode)
getAttributeAxisIterator
in class DefaultNavigator
contextNode
- The context node for the attribute axis.public Iterator getNamespaceAxisIterator(Object contextNode)
Note: this iterator is not live: it takes a snapshot and that snapshot remains static during the life of the iterator (i.e. it won't reflect subsequent changes to the DOM).
getNamespaceAxisIterator
in class DefaultNavigator
contextNode
- The context node for the Namespace axis.public XPath parseXPath(String xpath) throws org.saxpath.SAXPathException
org.jaxen.Navigator
xpath
- The xpath expression.XPath
public Object getDocumentNode(Object contextNode)
getDocumentNode
in class DefaultNavigator
contextNode
- Any node in the document.public String getElementNamespaceUri(Object object)
object
- The target node.public String getElementName(Object object)
object
- The target node.public String getElementQName(Object object)
object
- The target node.public String getAttributeNamespaceUri(Object object)
object
- The target node.A
- possibly-empty string representing the Namespace URI
if the node is an attribute, or null otherwise.public String getAttributeName(Object object)
object
- The target node.public String getAttributeQName(Object object)
object
- The target node.public boolean isDocument(Object object)
object
- The target node.public boolean isNamespace(Object object)
object
- The target node.public boolean isElement(Object object)
object
- The target node.public boolean isAttribute(Object object)
object
- The target node.public boolean isComment(Object object)
object
- The target node.public boolean isText(Object object)
object
- The target node.public boolean isProcessingInstruction(Object object)
object
- The target node.public String getElementStringValue(Object object)
object
- The target node.public String getAttributeStringValue(Object object)
object
- The target node.public String getTextStringValue(Object object)
object
- The target node.public String getCommentStringValue(Object object)
object
- The target node.public String getNamespaceStringValue(Object object)
object
- The target node.public String getNamespacePrefix(Object object)
object
- The target node.public String translateNamespacePrefixToUri(String prefix, Object element)
translateNamespacePrefixToUri
in class DefaultNavigator
org.jaxen.Navigator
prefix
- The prefix to translate.element
- The element to consider during translation.NamespaceContext
public Object getDocument(String uri) throws FunctionCallException
getDocument
in class DefaultNavigator
uri
- is the URI of the document to loadFunctionCallException
- containing a nested exception
if a problem occurs trying to parse the given documentpublic String getProcessingInstructionTarget(Object obj)
Navigator
getProcessingInstructionTarget
in class DefaultNavigator
org.jaxen.Navigator
pi
- The context processing-instruction node.public String getProcessingInstructionData(Object obj)
Navigator
getProcessingInstructionData
in class DefaultNavigator
org.jaxen.Navigator
pi
- The context processing-instruction node.public Object getElementById(Object object, String elementId)
setValidating(true)
on the
DocumentBuilderFactory.getElementById
in class DefaultNavigator
contextNode
- a node from the document in which to look for the
idelementId
- id to look forDocumentBuilderFactory
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |