org.apache.axis2.om.impl.dom
Class NodeImpl

java.lang.Object
  extended byorg.apache.axis2.om.impl.dom.NodeImpl
All Implemented Interfaces:
Cloneable, Node, NodeList, OMNode, OMNodeEx
Direct Known Subclasses:
AttrImpl, ChildNode, NodeImplEx

public abstract class NodeImpl
extends Object
implements Node, NodeList, OMNodeEx, Cloneable


Field Summary
protected  OMXMLParserWrapper builder
          Field builder
protected  boolean done
          Field done
protected static short FIRSTCHILD
           
protected  short flags
           
protected  int nodeType
          Field nodeType
protected static short NORMALIZED
           
protected static short OWNED
           
protected  DocumentImpl ownerNode
           
protected static short READONLY
           
protected static short SPECIFIED
           
 
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
 
Fields inherited from interface org.apache.axis2.om.OMNode
CDATA_SECTION_NODE, COMMENT_NODE, DTD_NODE, ELEMENT_NODE, ENTITY_REFERENCE_NODE, PI_NODE, SPACE_NODE, TEXT_NODE
 
Constructor Summary
protected NodeImpl()
           
protected NodeImpl(DocumentImpl ownerDocument)
           
 
Method Summary
 Node appendChild(Node newChild)
           
 void build()
          Builds next element.
 Node cloneNode(boolean deep)
           
 short compareDocumentPosition(Node arg0)
           
 OMNode detach()
          Removes a node (and all of its children) from its containing parent.
 NamedNodeMap getAttributes()
          Returns the collection of attributes associated with this node, or null if none.
 String getBaseURI()
           
 NodeList getChildNodes()
           
 Object getFeature(String arg0, String arg1)
           
 Node getFirstChild()
          Gets the first child of this Node, or null if none.
 Node getLastChild()
          Gets the last child of this Node, or null if none.
 int getLength()
          NodeList method: Returns the number of immediate children of this node.
 String getLocalName()
           
 String getNamespaceURI()
           
 OMNode getNextOMSibling()
          Default behavior returns null, overriden in ChildNode.
 Node getNextSibling()
          Returns the next child of this node's parent, or null if none.
 String getNodeValue()
           
 Document getOwnerDocument()
          Finds the document that this Node belongs to (the document in whose context the Node was created).
 OMContainer getParent()
          Returns the parent containing node.
 Node getParentNode()
           
 String getPrefix()
           
 OMNode getPreviousOMSibling()
          Default behavior returns null, overriden in ChildNode.
 Node getPreviousSibling()
          Returns the previous child of this node's parent, or null if none.
 String getTextContent()
           
 Object getUserData(String arg0)
           
 boolean hasAttributes()
           
 boolean hasChildNodes()
           
 Node insertBefore(Node newChild, Node refChild)
           
 void insertSiblingAfter(OMNode sibling)
          Inserts a new sibling after the current node.
 void insertSiblingBefore(OMNode sibling)
          Inserts a sibling just before the current node.
 boolean isComplete()
          Indicates whether parser has parsed this information item completely or not.
 boolean isDefaultNamespace(String arg0)
           
 boolean isEqualNode(Node arg0)
           
 boolean isSameNode(Node arg0)
           
 boolean isSupported(String feature, String version)
           
 Node item(int index)
          NodeList method: Returns the Nth immediate child of this node, or null if the index is out of bounds.
 String lookupNamespaceURI(String arg0)
           
 String lookupPrefix(String arg0)
           
 void normalize()
           
 Node removeChild(Node oldChild)
           
 Node replaceChild(Node newChild, Node oldChild)
           
 void serialize(OutputStream output)
          Serializes the node with caching.
 void serialize(OutputStream output, OMOutputFormat format)
          Serializes the node with caching.
 void serialize(Writer writer)
          Serializes the node with caching.
 void serialize(Writer writer, OMOutputFormat format)
          Serializes the node with caching.
 void serialize(XMLStreamWriter xmlWriter)
          Serializes the node with caching.
 void serializeAndConsume(OutputStream output)
          Serializes the node without caching.
 void serializeAndConsume(OutputStream output, OMOutputFormat format)
          Serializes the node without caching.
 void serializeAndConsume(Writer writer)
          Serializes the node without caching.
 void serializeAndConsume(Writer writer, OMOutputFormat format)
          Serializes the node without caching.
 void serializeAndConsume(XMLStreamWriter xmlWriter)
          Serializes the node without caching.
 void serializeWithCache(OMOutputImpl omOutput)
          There no concept of caching in this OM-DOM implementation.
 void setComplete(boolean state)
           
 void setNextOMSibling(OMNode previousSibling)
           
 void setNodeValue(String arg0)
           
protected  void setOwnerDocument(DocumentImpl document)
          Sets the owner document.
 void setPrefix(String prefix)
           
 void setPreviousOMSibling(OMNode previousSibling)
           
 void setTextContent(String arg0)
           
 Object setUserData(String arg0, Object arg1, UserDataHandler arg2)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.w3c.dom.Node
getNodeName, getNodeType
 
Methods inherited from interface org.apache.axis2.om.impl.OMNodeEx
serialize, serializeAndConsume, setParent, setType
 
Methods inherited from interface org.apache.axis2.om.OMNode
discard, getType
 

Field Detail

builder

protected OMXMLParserWrapper builder
Field builder


done

protected boolean done
Field done


nodeType

protected int nodeType
Field nodeType


ownerNode

protected DocumentImpl ownerNode

flags

protected short flags

OWNED

protected static final short OWNED
See Also:
Constant Field Values

FIRSTCHILD

protected static final short FIRSTCHILD
See Also:
Constant Field Values

READONLY

protected static final short READONLY
See Also:
Constant Field Values

SPECIFIED

protected static final short SPECIFIED
See Also:
Constant Field Values

NORMALIZED

protected static final short NORMALIZED
See Also:
Constant Field Values
Constructor Detail

NodeImpl

protected NodeImpl(DocumentImpl ownerDocument)

NodeImpl

protected NodeImpl()
Method Detail

normalize

public void normalize()
Specified by:
normalize in interface Node

hasAttributes

public boolean hasAttributes()
Specified by:
hasAttributes in interface Node

hasChildNodes

public boolean hasChildNodes()
Specified by:
hasChildNodes in interface Node

getLocalName

public String getLocalName()
Specified by:
getLocalName in interface Node

getNamespaceURI

public String getNamespaceURI()
Specified by:
getNamespaceURI in interface Node

getNodeValue

public String getNodeValue()
                    throws DOMException
Specified by:
getNodeValue in interface Node
Throws:
DOMException

getPrefix

public String getPrefix()
Specified by:
getPrefix in interface Node

setNodeValue

public void setNodeValue(String arg0)
                  throws DOMException
Specified by:
setNodeValue in interface Node
Throws:
DOMException

setPrefix

public void setPrefix(String prefix)
               throws DOMException
Specified by:
setPrefix in interface Node
Throws:
DOMException

getOwnerDocument

public Document getOwnerDocument()
Finds the document that this Node belongs to (the document in whose context the Node was created). The Node may or may not

Specified by:
getOwnerDocument in interface Node

getAttributes

public NamedNodeMap getAttributes()
Returns the collection of attributes associated with this node, or null if none. At this writing, Element is the only type of node which will ever have attributes.

Specified by:
getAttributes in interface Node
See Also:
ElementImpl

getFirstChild

public Node getFirstChild()
Gets the first child of this Node, or null if none.

By default we do not have any children, ParentNode overrides this.

Specified by:
getFirstChild in interface Node
See Also:
ParentNode

getLastChild

public Node getLastChild()
Gets the last child of this Node, or null if none.

By default we do not have any children, ParentNode overrides this.

Specified by:
getLastChild in interface Node
See Also:
ParentNode

getNextSibling

public Node getNextSibling()
Returns the next child of this node's parent, or null if none.

Specified by:
getNextSibling in interface Node

getParentNode

public Node getParentNode()
Specified by:
getParentNode in interface Node

getPreviousSibling

public Node getPreviousSibling()
Returns the previous child of this node's parent, or null if none.

Specified by:
getPreviousSibling in interface Node

cloneNode

public Node cloneNode(boolean deep)
Specified by:
cloneNode in interface Node

getChildNodes

public NodeList getChildNodes()
Specified by:
getChildNodes in interface Node

isSupported

public boolean isSupported(String feature,
                           String version)
Specified by:
isSupported in interface Node

appendChild

public Node appendChild(Node newChild)
                 throws DOMException
Specified by:
appendChild in interface Node
Throws:
DOMException

removeChild

public Node removeChild(Node oldChild)
                 throws DOMException
Specified by:
removeChild in interface Node
Throws:
DOMException

insertBefore

public Node insertBefore(Node newChild,
                         Node refChild)
                  throws DOMException
Specified by:
insertBefore in interface Node
Throws:
DOMException

replaceChild

public Node replaceChild(Node newChild,
                         Node oldChild)
                  throws DOMException
Specified by:
replaceChild in interface Node
Throws:
DOMException

getLength

public int getLength()
NodeList method: Returns the number of immediate children of this node.

By default we do not have any children, ParentNode overrides this.

Specified by:
getLength in interface NodeList
Returns:
Returns int.
See Also:
ParentNode

item

public Node item(int index)
NodeList method: Returns the Nth immediate child of this node, or null if the index is out of bounds.

By default we do not have any children, ParentNode overrides this.

Specified by:
item in interface NodeList
Parameters:
index -
Returns:
Returns org.w3c.dom.Node
See Also:
ParentNode

getParent

public OMContainer getParent()
                      throws OMException
Description copied from interface: OMNode
Returns the parent containing node.

Returns the parent container, which may be either an OMDocument or OMElement.

Specified by:
getParent in interface OMNode
Returns:
The OMContainer of the node.
Throws:
OMException

isComplete

public boolean isComplete()
Description copied from interface: OMNode
Indicates whether parser has parsed this information item completely or not. If some info are not available in the item, one has to check this attribute to make sure that, this item has been parsed completely or not.

Specified by:
isComplete in interface OMNode
Returns:
Returns boolean.

setComplete

public void setComplete(boolean state)
Specified by:
setComplete in interface OMNodeEx

serializeWithCache

public void serializeWithCache(OMOutputImpl omOutput)
                        throws XMLStreamException
There no concept of caching in this OM-DOM implementation.

Throws:
XMLStreamException

insertSiblingAfter

public void insertSiblingAfter(OMNode sibling)
                        throws OMException
Description copied from interface: OMNode
Inserts a new sibling after the current node.

Specified by:
insertSiblingAfter in interface OMNode
Parameters:
sibling - The node that will be added after the current node.
Throws:
OMException

insertSiblingBefore

public void insertSiblingBefore(OMNode sibling)
                         throws OMException
Description copied from interface: OMNode
Inserts a sibling just before the current node.

Specified by:
insertSiblingBefore in interface OMNode
Parameters:
sibling - The node that will be added before the current node.
Throws:
OMException

getPreviousOMSibling

public OMNode getPreviousOMSibling()
Default behavior returns null, overriden in ChildNode.

Specified by:
getPreviousOMSibling in interface OMNode
Returns:
Returns node.

getNextOMSibling

public OMNode getNextOMSibling()
Default behavior returns null, overriden in ChildNode.

Specified by:
getNextOMSibling in interface OMNode
Returns:
Returns the next sibling in document order.

setPreviousOMSibling

public void setPreviousOMSibling(OMNode previousSibling)
Specified by:
setPreviousOMSibling in interface OMNodeEx

setNextOMSibling

public void setNextOMSibling(OMNode previousSibling)
Specified by:
setNextOMSibling in interface OMNodeEx

build

public void build()
Builds next element.

Specified by:
build in interface OMNode

setOwnerDocument

protected void setOwnerDocument(DocumentImpl document)
Sets the owner document.

Parameters:
document -

serialize

public void serialize(XMLStreamWriter xmlWriter)
               throws XMLStreamException
Description copied from interface: OMNode
Serializes the node with caching.

Specified by:
serialize in interface OMNode
Parameters:
xmlWriter -
Throws:
XMLStreamException

serializeAndConsume

public void serializeAndConsume(XMLStreamWriter xmlWriter)
                         throws XMLStreamException
Description copied from interface: OMNode
Serializes the node without caching.

Specified by:
serializeAndConsume in interface OMNode
Parameters:
xmlWriter -
Throws:
XMLStreamException

detach

public OMNode detach()
Description copied from interface: OMNode
Removes a node (and all of its children) from its containing parent.

Removes a node from its parent. Partially complete nodes will be completed before they are detached from the model. A node cannot be detached until its next sibling has been identified, so that the next sibling and parent can be updated appropriately. Please note that this will not handle the namespaces. For example, if there you have used a namespace within the detaching node and which is defined outside the detaching node, user has to handle it manually.

Specified by:
detach in interface OMNode

getBaseURI

public String getBaseURI()

compareDocumentPosition

public short compareDocumentPosition(Node arg0)
                              throws DOMException
Throws:
DOMException

getTextContent

public String getTextContent()
                      throws DOMException
Throws:
DOMException

setTextContent

public void setTextContent(String arg0)
                    throws DOMException
Throws:
DOMException

isSameNode

public boolean isSameNode(Node arg0)

lookupPrefix

public String lookupPrefix(String arg0)

isDefaultNamespace

public boolean isDefaultNamespace(String arg0)

lookupNamespaceURI

public String lookupNamespaceURI(String arg0)

isEqualNode

public boolean isEqualNode(Node arg0)

getFeature

public Object getFeature(String arg0,
                         String arg1)

setUserData

public Object setUserData(String arg0,
                          Object arg1,
                          UserDataHandler arg2)

getUserData

public Object getUserData(String arg0)

serialize

public void serialize(OutputStream output)
               throws XMLStreamException
Description copied from interface: OMNode
Serializes the node with caching.

Specified by:
serialize in interface OMNode
Parameters:
output -
Throws:
XMLStreamException

serialize

public void serialize(Writer writer)
               throws XMLStreamException
Description copied from interface: OMNode
Serializes the node with caching.

Specified by:
serialize in interface OMNode
Parameters:
writer -
Throws:
XMLStreamException

serializeAndConsume

public void serializeAndConsume(OutputStream output)
                         throws XMLStreamException
Description copied from interface: OMNode
Serializes the node without caching.

Specified by:
serializeAndConsume in interface OMNode
Parameters:
output -
Throws:
XMLStreamException

serializeAndConsume

public void serializeAndConsume(Writer writer)
                         throws XMLStreamException
Description copied from interface: OMNode
Serializes the node without caching.

Specified by:
serializeAndConsume in interface OMNode
Parameters:
writer -
Throws:
XMLStreamException

serialize

public void serialize(OutputStream output,
                      OMOutputFormat format)
               throws XMLStreamException
Description copied from interface: OMNode
Serializes the node with caching.

Specified by:
serialize in interface OMNode
Parameters:
output -
format -
Throws:
XMLStreamException

serialize

public void serialize(Writer writer,
                      OMOutputFormat format)
               throws XMLStreamException
Description copied from interface: OMNode
Serializes the node with caching.

Specified by:
serialize in interface OMNode
Parameters:
writer -
format -
Throws:
XMLStreamException

serializeAndConsume

public void serializeAndConsume(OutputStream output,
                                OMOutputFormat format)
                         throws XMLStreamException
Description copied from interface: OMNode
Serializes the node without caching.

Specified by:
serializeAndConsume in interface OMNode
Parameters:
output -
format -
Throws:
XMLStreamException

serializeAndConsume

public void serializeAndConsume(Writer writer,
                                OMOutputFormat format)
                         throws XMLStreamException
Description copied from interface: OMNode
Serializes the node without caching.

Specified by:
serializeAndConsume in interface OMNode
Parameters:
writer -
format -
Throws:
XMLStreamException