jd.xml.xpath.model
Interface XPathNode

All Known Subinterfaces:
XPathRootNode
All Known Implementing Classes:
AbstractXPathNode, RootNode

public interface XPathNode

XPathNode models a node as described in the XPath data model.


Field Summary
static int ATTRIBUTE
           
static int COMMENT
           
static int ELEMENT
           
static int NAMESPACE
           
static int PI
           
static int ROOT
           
static int TEXT
           
static String[] TYPE_NAMES
           
static int TYPES
          The number of existing types.
static int UNKNOWN
           
 
Method Summary
 void accept(NodeVisitor visitor)
          Dispatch method for NodeVisitors.
 int compareToNode(XPathNode node)
          Compare to another XPathNode from the same document.
 boolean equals(Object object)
          Test if an object is equal to this node.
 boolean equalsNode(XPathNode node)
          Test if the node equals the given node.
 XPathNode[] getAttributes()
          Return the Attributes of this XPathNode.
 String getBaseUri()
          Return the base uri of the node, determined by the value of the xml:base attribute on the node, or, if it has no xml:base attribute, by the value of the xml:base attribute on the nearest ancestor of the node that has an xml:base attribute and the given document uri.
 XPathNode getCacheableNode()
          Return a node object which can be cached without eating up any resources.
 int getChildCount()
          Return the number of children.
 XPathNode getFirstChild()
          Return the first child.
 XPathNode getFirstSibling()
          Return the first sibling.
 String getGlobalId()
          Return an unique global identifier for the node.
 String getLanguage()
          Return the language of the node, determined by the value of the xml:lang attribute on the node, or, if it has no xml:lang attribute, by the value of the xml:lang attribute on the nearest ancestor of the node that has an xml:lang attribute.
 int getLineNumber()
          Return the line number of this node in a source document.
 int getLocalId()
          Return a number for the node that is unique within the document.
 String getLocalName()
          Return the local name of the node.
 String getName()
          Return the name of the node.
 NamespaceContext getNamespaceContext()
          Return the namespace context of the node.
 XPathNode[] getNamespaceNodes()
          Return the NamespaceNodes of this XPathNode.
 String getNamespaceUri()
          Return the namespace uri of the node.
 XPathNode getNextSibling()
          Return the next sibling.
 NodeName getNodeName()
          Return the nodename of the node.
 XPathNode getParent()
          Return the parent of this node.
 String getPrefix()
          Return the prefix of the node.
 XPathNode getPrevSibling()
          Return the previous sibling.
 XPathRootNode getRoot()
          Return the root of this node.
 int getType()
          Return the type of the XPathNode.
 String getTypeName()
          Return name of the type.
 String getValue()
          Return the string value of this node.
 int hashCode()
          Return a hashCode.
 boolean hasName(NodeName name)
          Test if the node name equals the given name.
 boolean hasNamespaceUri(NodeName name)
          Test if the namespace uri of this node equals the uri of the given NodeName.
 String toString()
          Return a string representation.
 

Field Detail

ELEMENT

public static final int ELEMENT
See Also:
Constant Field Values

TEXT

public static final int TEXT
See Also:
Constant Field Values

ATTRIBUTE

public static final int ATTRIBUTE
See Also:
Constant Field Values

ROOT

public static final int ROOT
See Also:
Constant Field Values

COMMENT

public static final int COMMENT
See Also:
Constant Field Values

PI

public static final int PI
See Also:
Constant Field Values

NAMESPACE

public static final int NAMESPACE
See Also:
Constant Field Values

TYPES

public static final int TYPES
The number of existing types. The first type has type code = 0 the last has type code TYPES - 1

See Also:
Constant Field Values

UNKNOWN

public static final int UNKNOWN
See Also:
Constant Field Values

TYPE_NAMES

public static final String[] TYPE_NAMES
Method Detail

getType

public int getType()
Return the type of the XPathNode.

Returns:
a type constant

getTypeName

public String getTypeName()
Return name of the type.


getRoot

public XPathRootNode getRoot()
Return the root of this node.


getParent

public XPathNode getParent()
Return the parent of this node.


getChildCount

public int getChildCount()
Return the number of children.


getFirstChild

public XPathNode getFirstChild()
Return the first child.

Returns:
the first child or null

getNextSibling

public XPathNode getNextSibling()
Return the next sibling.

Returns:
the next sibling or null

getPrevSibling

public XPathNode getPrevSibling()
Return the previous sibling.

Returns:
the previous sibling or null

getFirstSibling

public XPathNode getFirstSibling()
Return the first sibling.


getCacheableNode

public XPathNode getCacheableNode()
Return a node object which can be cached without eating up any resources.


getValue

public String getValue()
Return the string value of this node.


getNodeName

public NodeName getNodeName()
Return the nodename of the node.

Returns:
the name or null if the node has no name

getName

public String getName()
Return the name of the node.


getLocalName

public String getLocalName()
Return the local name of the node.


getPrefix

public String getPrefix()
Return the prefix of the node.


getNamespaceUri

public String getNamespaceUri()
Return the namespace uri of the node.


hasName

public boolean hasName(NodeName name)
Test if the node name equals the given name.


hasNamespaceUri

public boolean hasNamespaceUri(NodeName name)
Test if the namespace uri of this node equals the uri of the given NodeName.


getAttributes

public XPathNode[] getAttributes()
Return the Attributes of this XPathNode.

Returns:
null if the node is not a ElementNode or has no attributes.

getLanguage

public String getLanguage()
Return the language of the node, determined by the value of the xml:lang attribute on the node, or, if it has no xml:lang attribute, by the value of the xml:lang attribute on the nearest ancestor of the node that has an xml:lang attribute. If there is such an attribute, null is returned.


getBaseUri

public String getBaseUri()
Return the base uri of the node, determined by the value of the xml:base attribute on the node, or, if it has no xml:base attribute, by the value of the xml:base attribute on the nearest ancestor of the node that has an xml:base attribute and the given document uri.


getNamespaceNodes

public XPathNode[] getNamespaceNodes()
Return the NamespaceNodes of this XPathNode.

Returns:
null if the node is not a ElementNode or has no attributes.

getNamespaceContext

public NamespaceContext getNamespaceContext()
Return the namespace context of the node.


getLocalId

public int getLocalId()
Return a number for the node that is unique within the document.


getGlobalId

public String getGlobalId()
Return an unique global identifier for the node. (global with respect to all other node objects in the current VM)


compareToNode

public int compareToNode(XPathNode node)
Compare to another XPathNode from the same document. Return a negative or a positive integer as this node comes before or after the argument node in document order. Return zero if the node equal this node.


equalsNode

public boolean equalsNode(XPathNode node)
Test if the node equals the given node.


getLineNumber

public int getLineNumber()
Return the line number of this node in a source document.

Returns:
the line number or -1 if not known

accept

public void accept(NodeVisitor visitor)
Dispatch method for NodeVisitors.


equals

public boolean equals(Object object)
Test if an object is equal to this node.


hashCode

public int hashCode()
Return a hashCode.


toString

public String toString()
Return a string representation.