com.novell.xml.xpath
Class XPathNamespaceNode

java.lang.Object
  extended bycom.novell.xml.dom.NodeDecorator
      extended bycom.novell.xml.xpath.XPathNamespaceNode
All Implemented Interfaces:
Comparable, Namespace, Node

public class XPathNamespaceNode
extends NodeDecorator
implements Comparable, Namespace

A Node implementation that provides the functionality of the XPath namespace node. It is implemented in terms of decorating a DOM attribute node.


Field Summary
 
Fields inherited from class com.novell.xml.dom.NodeDecorator
node
 
Fields inherited from interface com.novell.xml.dom.Namespace
NAMESPACE_NODE
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Constructor Summary
XPathNamespaceNode(String prefix, String uri, Node ownerElement)
          Constructs a new decorator that decorates an attribute node and is a namespace of the specified element node.
 
Method Summary
 int compareTo(Object obj)
          Compares this namespace node to another namespace node for document order.
 boolean equals(Object obj)
          Indicates whether some other object is "equal to" this one.
 NamespaceName getNamespaceName()
          Return the NamespaceName object for this namespace node.
 String getNodeName()
          DOM-defined method that returns the name of the node.
 short getNodeType()
          DOM-defined method that returns a code representing the type of the underlying object.
 String getNodeValue()
          Dom-defined method that returns the text value of a node.
 Node getParentNode()
          DOM-defined method that returns the parent of this namespace node.
 
Methods inherited from class com.novell.xml.dom.NodeDecorator
appendChild, cloneNode, getAttributes, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getOwnerDocument, getPrefix, getPreviousSibling, hasAttributes, hasChildNodes, insertBefore, isSupported, normalize, removeChild, replaceChild, setNodeValue, setPrefix
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, getAttributes, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getOwnerDocument, getPrefix, getPreviousSibling, hasAttributes, hasChildNodes, insertBefore, isSupported, normalize, removeChild, replaceChild, setNodeValue, setPrefix
 

Constructor Detail

XPathNamespaceNode

public XPathNamespaceNode(String prefix,
                          String uri,
                          Node ownerElement)
Constructs a new decorator that decorates an attribute node and is a namespace of the specified element node.

Parameters:
ownerElement - the element node of which this node is a namespace node
Method Detail

getNodeType

public final short getNodeType()
DOM-defined method that returns a code representing the type of the underlying object.

Specified by:
getNodeType in interface Node
Overrides:
getNodeType in class NodeDecorator
Returns:
Namespace.NAMESPACE_NODE;

getParentNode

public final Node getParentNode()
DOM-defined method that returns the parent of this namespace node. In DOM Level 1, there are no namespace nodes. In XPath, the parent of a namespace node is the owning element

Specified by:
getParentNode in interface Node
Overrides:
getParentNode in class NodeDecorator
Returns:
the Element node of which this node is an attribute

getNodeName

public final String getNodeName()
DOM-defined method that returns the name of the node. For a namespace node this is the prefix representing the namespace.

Specified by:
getNodeName in interface Node
Overrides:
getNodeName in class NodeDecorator
Returns:
The namespace prefix.

getNodeValue

public final String getNodeValue()
Dom-defined method that returns the text value of a node. For a namespace node this is the namespace value, or URI.

Specified by:
getNodeValue in interface Node
Overrides:
getNodeValue in class NodeDecorator
Returns:
The namespace URI.

getNamespaceName

public NamespaceName getNamespaceName()
Return the NamespaceName object for this namespace node. This should generally be used in preference to getNodeValue() (which returns the string value of the uri) because NamespaceName objects can be compared much more efficiently than can strings.

Specified by:
getNamespaceName in interface Namespace
Returns:
The NamespaceName of this namespace node

compareTo

public int compareTo(Object obj)
Compares this namespace node to another namespace node for document order. The namespaces are assumed to belong to the same element. The 16Jun99 draft does not define document order for namespaces, so for now we assume lexicographic order of the namespace names.

Specified by:
compareTo in interface Comparable
Parameters:
obj - the other XPathNamespaceNode to compare with; it is declared as an Object to conform with the Comparable interface
Returns:
a negative integer, zero, or a positive integer depending on whether this attribute node precedes, is the same as, or follows the other node
Throws:
ClassCastException - if the specified object is not an XPathNamespaceNode

equals

public boolean equals(Object obj)
Indicates whether some other object is "equal to" this one. This implementation returns true if and only if the other object is the SAME object as this one.

Parameters:
obj - the object to compare against
Returns:
true if this object is "equal to" obj, false if not