org.apache.batik.dom
Class AbstractNode

java.lang.Object
  extended by org.apache.batik.dom.AbstractNode
All Implemented Interfaces:
Serializable, NodeEventTarget, ExtendedNode, NodeXBL, XBLManagerData, EventTarget, Node
Direct Known Subclasses:
AbstractChildNode, AbstractNotation, AbstractParentNode

public abstract class AbstractNode
extends Object
implements ExtendedNode, NodeXBL, XBLManagerData, Serializable

This class implements the Node interface.

See Also:
Serialized Form

Field Summary
static short DOCUMENT_POSITION_CONTAINED_BY
           
static short DOCUMENT_POSITION_CONTAINS
           
static short DOCUMENT_POSITION_DISCONNECTED
           
static short DOCUMENT_POSITION_FOLLOWING
           
static short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC
           
static short DOCUMENT_POSITION_PRECEDING
           
static NodeList EMPTY_NODE_LIST
          An empty instance of NodeList.
protected  EventSupport eventSupport
          The event support.
protected  Object managerData
          The XBL manager data.
protected  AbstractDocument ownerDocument
          The owner document.
protected  HashMap userData
          User data.
protected  HashMap userDataHandlers
          User data handlers.
 
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
AbstractNode()
           
 
Method Summary
 void addEventListener(String type, EventListener listener, boolean useCapture)
          DOM: Implements EventTarget.addEventListener(String,EventListener,boolean).
 void addEventListenerNS(String namespaceURI, String type, EventListener listener, boolean useCapture, Object evtGroup)
          DOM: Implements NodeEventTarget.addEventListenerNS(String,String,EventListener,boolean,Object).
 Node appendChild(Node newChild)
          DOM: Implements Node.appendChild(Node).
protected  void checkChildType(Node n, boolean replace)
          Checks the validity of a node to be inserted.
 Node cloneNode(boolean deep)
          DOM: Implements Node.cloneNode(boolean).
 short compareDocumentPosition(Node other)
          DOM: Implements Node.compareDocumentPosition(Node).
protected  boolean compareNamedNodeMaps(NamedNodeMap nnm1, NamedNodeMap nnm2)
          Compare two NamedNodeMaps for equality.
protected  boolean compareStrings(String s1, String s2)
          Compare two strings for equality.
protected  Node copyInto(Node n)
          Copy the fields of the current node into the given node.
 DOMException createDOMException(short type, String key, Object[] args)
          Creates an exception with the appropriate error message.
protected  Node deepCopyInto(Node n)
          Deeply copy the fields of the current node into the given node.
protected  Node deepExport(Node n, AbstractDocument d)
          Deeply exports this node to the given document.
 boolean dispatchEvent(Event evt)
          DOM: Implements EventTarget.dispatchEvent(Event).
protected  Node export(Node n, AbstractDocument d)
          Exports this node to the given document.
protected  void fireDOMCharacterDataModifiedEvent(String oldv, String newv)
          Fires a DOMCharacterDataModified event.
 void fireDOMNodeInsertedIntoDocumentEvent()
          Recursively fires a DOMNodeInsertedIntoDocument event.
 void fireDOMNodeRemovedFromDocumentEvent()
          Recursively fires a DOMNodeRemovedFromDocument event.
protected  void fireUserDataHandlers(short type, Node oldNode, Node newNode)
          Fire any UserDataHandlers on the given oldNode.
 NamedNodeMap getAttributes()
          DOM: Implements Node.getAttributes().
 String getBaseURI()
          DOM: Implements Node.getBaseURI().
static String getBaseURI(Node n)
           
protected  String getCascadedXMLBase(Node node)
          Returns the xml:base attribute value of the given element, resolving any dependency on parent bases if needed.
 NodeList getChildNodes()
          DOM: Implements Node.getChildNodes().
protected  AbstractDocument getCurrentDocument()
          Returns the current document.
 EventSupport getEventSupport()
          Returns the event support instance for this node, or null if any.
 Object getFeature(String feature, String version)
          DOM: Implements Node.getFeature(String,String).
 Node getFirstChild()
          DOM: Implements Node.getFirstChild().
 Node getLastChild()
          DOM: Implements Node.getLastChild().
 String getLocalName()
          DOM: Implements Node.getLocalName().
 Object getManagerData()
          Returns the XBL manager associated data for this node.
 String getNamespaceURI()
          DOM: Implements Node.getNamespaceURI().
 Node getNextSibling()
          DOM: Implements Node.getNextSibling().
 String getNodeValue()
          DOM: Implements Node.getNodeValue().
 Document getOwnerDocument()
          DOM: Implements Node.getOwnerDocument().
 Node getParentNode()
          DOM: Implements Node.getParentNode().
 NodeEventTarget getParentNodeEventTarget()
          Implements NodeEventTarget.getParentNodeEventTarget().
 String getPrefix()
          DOM: Implements Node.getPrefix().
 Node getPreviousSibling()
          DOM: Implements Node.getPreviousSibling().
 String getTextContent()
          DOM: Implements Node.getTextContent().
 Object getUserData(String key)
          DOM: Implements Node.getUserData(String).
 Element getXblBoundElement()
          Get the bound element whose shadow tree this current node resides in.
 NodeList getXblChildNodes()
          Get the list of child nodes of this node in the fully flattened tree.
 NodeList getXblDefinitions()
          Get the xbl:definition elements currently binding this element.
 Node getXblFirstChild()
          Get the first child node of this node in the fully flattened tree.
 Element getXblFirstElementChild()
          Get the first element child of this node in the fully flattened tree.
 Node getXblLastChild()
          Get the last child node of this node in the fully flattened tree.
 Element getXblLastElementChild()
          Get the last element child of this node in the fully flattened tree.
 Element getXblNextElementSibling()
          Get the first element that follows the current node in the xblParentNode's xblChildNodes list.
 Node getXblNextSibling()
          Get the node which directly follows the current node in the xblParentNode's xblChildNodes list.
 Node getXblParentNode()
          Get the parent of this node in the fully flattened tree.
 Element getXblPreviousElementSibling()
          Get the first element that precedes the current node in the xblParentNode's xblChildNodes list.
 Node getXblPreviousSibling()
          Get the node which directly precedes the current node in the xblParentNode's xblChildNodes list.
 NodeList getXblScopedChildNodes()
          Get the list of child nodes of this node in the fully flattened tree that are within the same shadow scope.
 Element getXblShadowTree()
          Get the shadow tree of this node.
 boolean hasAttributes()
          DOM: Implements Node.hasAttributes().
 boolean hasChildNodes()
          DOM: Implements Node.hasChildNodes().
 boolean hasEventListenerNS(String namespaceURI, String type)
          DOM: Implements EventTarget.hasEventListenerNS(String,String) from an old draft of DOM Level 3 Events.
 EventSupport initializeEventSupport()
          Initializes the event support instance for this node if it has not been already, and returns it.
 Node insertBefore(Node newChild, Node refChild)
          DOM: Implements Node.insertBefore(Node, Node).
 boolean isDefaultNamespace(String namespaceURI)
          DOM: Implements Node.isDefaultNamespace(String).
 boolean isEqualNode(Node other)
          DOM: Implements Node.isEqualNode(Node).
 boolean isSameNode(Node other)
          DOM: Implements Node.isSameNode(Node).
 boolean isSupported(String feature, String version)
          DOM: Implements Node.isSupported(String,String).
protected  String lookupNamespacePrefix(String namespaceURI, Element originalElement)
          Helper function for lookupPrefix(java.lang.String).
 String lookupNamespaceURI(String prefix)
          DOM: Implements Node.lookupNamespaceURI(String).
 String lookupPrefix(String namespaceURI)
          DOM: Implements Node.lookupPrefix(String).
protected abstract  Node newNode()
          Returns a new uninitialized instance of this object's class.
 void normalize()
          DOM: Implements Node.normalize().
 Node removeChild(Node oldChild)
          DOM: Implements Node.removeChild(Node).
 void removeEventListener(String type, EventListener listener, boolean useCapture)
          DOM: Implements EventTarget.removeEventListener(String,EventListener,boolean).
 void removeEventListenerNS(String namespaceURI, String type, EventListener listener, boolean useCapture)
          DOM: Implements NodeEventTarget.removeEventListenerNS(String,String,EventListener,boolean).
 Node replaceChild(Node newChild, Node oldChild)
          DOM: Implements Node.replaceChild(Node, Node).
 void setManagerData(Object data)
          Sets the XBL manager associated data for this node.
 void setNextSibling(Node n)
          Sets the node immediately following this node.
 void setNodeName(String v)
          Sets the name of this node.
 void setNodeValue(String nodeValue)
          DOM: Implements Node.setNodeValue(String).
 void setOwnerDocument(Document doc)
          Sets the owner document of this node.
 void setParentNode(Node v)
          Sets the parent node.
 void setPrefix(String prefix)
          DOM: Implements Node.setPrefix(String).
 void setPreviousSibling(Node n)
          Sets the node immediately preceding this node.
 void setSpecified(boolean v)
          Sets the value of the specified attribute.
 void setTextContent(String s)
          DOM: Implements Node.setTextContent(String).
 Object setUserData(String key, Object data, UserDataHandler handler)
          DOM: Implements Node.setUserData(String,Object,UserDataHandler).
 boolean willTriggerNS(String namespaceURI, String type)
          DOM: Implements EventTarget#willTriggerNS(String,String) from an old draft of DOM Level 3 Events.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.batik.dom.ExtendedNode
isReadonly, setReadonly
 
Methods inherited from interface org.w3c.dom.Node
getNodeName, getNodeType
 

Field Detail

EMPTY_NODE_LIST

public static final NodeList EMPTY_NODE_LIST
An empty instance of NodeList.


ownerDocument

protected AbstractDocument ownerDocument
The owner document.


eventSupport

protected transient EventSupport eventSupport
The event support.


userData

protected HashMap userData
User data.


userDataHandlers

protected HashMap userDataHandlers
User data handlers.


managerData

protected Object managerData
The XBL manager data.


DOCUMENT_POSITION_DISCONNECTED

public static final short DOCUMENT_POSITION_DISCONNECTED
See Also:
Constant Field Values

DOCUMENT_POSITION_PRECEDING

public static final short DOCUMENT_POSITION_PRECEDING
See Also:
Constant Field Values

DOCUMENT_POSITION_FOLLOWING

public static final short DOCUMENT_POSITION_FOLLOWING
See Also:
Constant Field Values

DOCUMENT_POSITION_CONTAINS

public static final short DOCUMENT_POSITION_CONTAINS
See Also:
Constant Field Values

DOCUMENT_POSITION_CONTAINED_BY

public static final short DOCUMENT_POSITION_CONTAINED_BY
See Also:
Constant Field Values

DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC

public static final short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC
See Also:
Constant Field Values
Constructor Detail

AbstractNode

public AbstractNode()
Method Detail

setNodeName

public void setNodeName(String v)
Sets the name of this node. Do nothing.

Specified by:
setNodeName in interface ExtendedNode

setOwnerDocument

public void setOwnerDocument(Document doc)
Sets the owner document of this node.

Specified by:
setOwnerDocument in interface ExtendedNode

setSpecified

public void setSpecified(boolean v)
Sets the value of the specified attribute. This method only applies to Attr objects.

Specified by:
setSpecified in interface ExtendedNode

getNodeValue

public String getNodeValue()
                    throws DOMException
DOM: Implements Node.getNodeValue().

Specified by:
getNodeValue in interface Node
Returns:
null.
Throws:
DOMException

setNodeValue

public void setNodeValue(String nodeValue)
                  throws DOMException
DOM: Implements Node.setNodeValue(String). Do nothing.

Specified by:
setNodeValue in interface Node
Throws:
DOMException

getParentNode

public Node getParentNode()
DOM: Implements Node.getParentNode().

Specified by:
getParentNode in interface Node
Returns:
null.

setParentNode

public void setParentNode(Node v)
Sets the parent node. Throws a HIERARCHY_REQUEST_ERR DOMException.

Specified by:
setParentNode in interface ExtendedNode

getChildNodes

public NodeList getChildNodes()
DOM: Implements Node.getChildNodes().

Specified by:
getChildNodes in interface Node
Returns:
EMPTY_NODE_LIST.

getFirstChild

public Node getFirstChild()
DOM: Implements Node.getFirstChild().

Specified by:
getFirstChild in interface Node
Returns:
null.

getLastChild

public Node getLastChild()
DOM: Implements Node.getLastChild().

Specified by:
getLastChild in interface Node
Returns:
null.

setPreviousSibling

public void setPreviousSibling(Node n)
Sets the node immediately preceding this node. Throws a HIERARCHY_REQUEST_ERR DOMException.

Specified by:
setPreviousSibling in interface ExtendedNode

getPreviousSibling

public Node getPreviousSibling()
DOM: Implements Node.getPreviousSibling().

Specified by:
getPreviousSibling in interface Node
Returns:
null.

setNextSibling

public void setNextSibling(Node n)
Sets the node immediately following this node. Throws a HIERARCHY_REQUEST_ERR DOMException.

Specified by:
setNextSibling in interface ExtendedNode

getNextSibling

public Node getNextSibling()
DOM: Implements Node.getNextSibling().

Specified by:
getNextSibling in interface Node
Returns:
null.

hasAttributes

public boolean hasAttributes()
DOM: Implements Node.hasAttributes().

Specified by:
hasAttributes in interface Node
Returns:
false.

getAttributes

public NamedNodeMap getAttributes()
DOM: Implements Node.getAttributes().

Specified by:
getAttributes in interface Node
Returns:
null.

getOwnerDocument

public Document getOwnerDocument()
DOM: Implements Node.getOwnerDocument().

Specified by:
getOwnerDocument in interface Node
Returns:
ownerDocument.

getNamespaceURI

public String getNamespaceURI()
DOM: Implements Node.getNamespaceURI().

Specified by:
getNamespaceURI in interface Node
Returns:
null.

insertBefore

public Node insertBefore(Node newChild,
                         Node refChild)
                  throws DOMException
DOM: Implements Node.insertBefore(Node, Node). Throws a HIERARCHY_REQUEST_ERR DOMException.

Specified by:
insertBefore in interface Node
Throws:
DOMException

replaceChild

public Node replaceChild(Node newChild,
                         Node oldChild)
                  throws DOMException
DOM: Implements Node.replaceChild(Node, Node). Throws a HIERARCHY_REQUEST_ERR DOMException.

Specified by:
replaceChild in interface Node
Throws:
DOMException

removeChild

public Node removeChild(Node oldChild)
                 throws DOMException
DOM: Implements Node.removeChild(Node). Throws a HIERARCHY_REQUEST_ERR DOMException.

Specified by:
removeChild in interface Node
Throws:
DOMException

appendChild

public Node appendChild(Node newChild)
                 throws DOMException
DOM: Implements Node.appendChild(Node). Throws a HIERARCHY_REQUEST_ERR DOMException.

Specified by:
appendChild in interface Node
Throws:
DOMException

hasChildNodes

public boolean hasChildNodes()
DOM: Implements Node.hasChildNodes().

Specified by:
hasChildNodes in interface Node
Returns:
false.

cloneNode

public Node cloneNode(boolean deep)
DOM: Implements Node.cloneNode(boolean).

Specified by:
cloneNode in interface Node

normalize

public void normalize()
DOM: Implements Node.normalize(). Do nothing.

Specified by:
normalize in interface Node

isSupported

public boolean isSupported(String feature,
                           String version)
DOM: Implements Node.isSupported(String,String).

Specified by:
isSupported in interface Node

getPrefix

public String getPrefix()
DOM: Implements Node.getPrefix().

Specified by:
getPrefix in interface Node

setPrefix

public void setPrefix(String prefix)
               throws DOMException
DOM: Implements Node.setPrefix(String).

Specified by:
setPrefix in interface Node
Throws:
DOMException

getLocalName

public String getLocalName()
DOM: Implements Node.getLocalName().

Specified by:
getLocalName in interface Node

createDOMException

public DOMException createDOMException(short type,
                                       String key,
                                       Object[] args)
Creates an exception with the appropriate error message.


getCascadedXMLBase

protected String getCascadedXMLBase(Node node)
Returns the xml:base attribute value of the given element, resolving any dependency on parent bases if needed.


getBaseURI

public String getBaseURI()
DOM: Implements Node.getBaseURI().

Specified by:
getBaseURI in interface Node

getBaseURI

public static String getBaseURI(Node n)

compareDocumentPosition

public short compareDocumentPosition(Node other)
                              throws DOMException
DOM: Implements Node.compareDocumentPosition(Node). XXX Doesn't handle notation or entity nodes.

Specified by:
compareDocumentPosition in interface Node
Throws:
DOMException

getTextContent

public String getTextContent()
DOM: Implements Node.getTextContent().

Specified by:
getTextContent in interface Node

setTextContent

public void setTextContent(String s)
                    throws DOMException
DOM: Implements Node.setTextContent(String).

Specified by:
setTextContent in interface Node
Throws:
DOMException

isSameNode

public boolean isSameNode(Node other)
DOM: Implements Node.isSameNode(Node).

Specified by:
isSameNode in interface Node

lookupPrefix

public String lookupPrefix(String namespaceURI)
DOM: Implements Node.lookupPrefix(String).

Specified by:
lookupPrefix in interface Node

lookupNamespacePrefix

protected String lookupNamespacePrefix(String namespaceURI,
                                       Element originalElement)
Helper function for lookupPrefix(java.lang.String).


isDefaultNamespace

public boolean isDefaultNamespace(String namespaceURI)
DOM: Implements Node.isDefaultNamespace(String).

Specified by:
isDefaultNamespace in interface Node

lookupNamespaceURI

public String lookupNamespaceURI(String prefix)
DOM: Implements Node.lookupNamespaceURI(String).

Specified by:
lookupNamespaceURI in interface Node

isEqualNode

public boolean isEqualNode(Node other)
DOM: Implements Node.isEqualNode(Node).

Specified by:
isEqualNode in interface Node

compareStrings

protected boolean compareStrings(String s1,
                                 String s2)
Compare two strings for equality.


compareNamedNodeMaps

protected boolean compareNamedNodeMaps(NamedNodeMap nnm1,
                                       NamedNodeMap nnm2)
Compare two NamedNodeMaps for equality.


getFeature

public Object getFeature(String feature,
                         String version)
DOM: Implements Node.getFeature(String,String).

Specified by:
getFeature in interface Node

getUserData

public Object getUserData(String key)
DOM: Implements Node.getUserData(String).

Specified by:
getUserData in interface Node

setUserData

public Object setUserData(String key,
                          Object data,
                          UserDataHandler