org.jbind.xml.dom3.core
Class DomNode

java.lang.Object
  extended byorg.jbind.xml.dom3.core.DomObject
      extended byorg.jbind.xml.dom3.core.DomNode
All Implemented Interfaces:
IDomNode, IDomObject, IHasLocation, org.w3c.dom.Node
Direct Known Subclasses:
DomAttrOrElm, DomNonAttrOrElm

public abstract class DomNode
extends DomObject
implements IDomNode


Field Summary
protected  IDomNodeList myChildNodes
          A NodeList that contains all children of this node.
protected  DomNode myParentNode
          (required).
 
Fields inherited from class org.jbind.xml.dom3.core.DomObject
myOwnerDocument
 
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
  DomNode(IDomDocument aDocument)
           
protected DomNode(IDomNode aDomNode, boolean aDeep)
           
 
Method Summary
 void accept(IDomVisitor aVisitor)
           
 IElementImpl addElement(java.lang.String aNamespace, java.lang.String aQName)
           
 IElementImpl addElement(java.lang.String aNamespace, java.lang.String aQName, java.util.Map aPrefixMappings, ILocation aLocation)
           
 ITextImpl addText(java.lang.String aText, ILocation aLocation)
           
 org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild)
           
protected static java.lang.String collectTextContent(IDomNodeList aDomNodeList)
           
protected static void collectTextContent(IDomNodeList aDomNodeList, StrBuffer aStrBuffer)
          Recursively collects the text content of the nodes in the specified node list.
 short compareTreePosition(org.w3c.dom.Node other)
           
protected abstract  void doAfterAccept(IDomVisitor aVisitor)
           
protected abstract  void doBeforeAccept(IDomVisitor aVisitor)
           
protected abstract  IDomNodeList doCloneChildNodes(IDomNodeList aDomNodeList, boolean aDeep)
          Hook method for cloning the child nodes.
protected  org.w3c.dom.Node getAncestor()
          Gets the parent or owner element.
 java.lang.String getBaseURI()
           
 IImpl getChild(int anIndex)
           
protected  org.w3c.dom.Node getChildByClass(java.lang.Class aClass)
           
 org.w3c.dom.NodeList getChildNodes()
           
 org.w3c.dom.Node getFirstChild()
           
 org.w3c.dom.Node getInterface(java.lang.String aFeature)
           
 org.w3c.dom.Node getLastChild()
           
 ILocation getLocation()
           
 java.lang.String getNamespaceForPrefix(java.lang.String aPrefix)
           
 int getNbChildren()
           
 org.w3c.dom.Node getNextSibling()
           
 int getNonDefaultedNbChildren()
           
 IImplContainer getParentImpl()
           
 org.w3c.dom.Node getParentNode()
           
 java.lang.String getPrefixForNamespace(java.lang.String aNamespace, boolean aCreate)
           
 java.util.Map getPrefixToNamespaceMapping()
           
 org.w3c.dom.Node getPreviousSibling()
           
 java.lang.Object getUserData(java.lang.String aKey)
           
 boolean hasChildNodes()
           
 org.w3c.dom.Node insertAfter(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild)
           
 org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild)
           
 boolean isEqualNode(org.w3c.dom.Node aNode, boolean aDeep)
           
 boolean isSameNode(org.w3c.dom.Node aNode)
           
 boolean isSupported(java.lang.String aFeature, java.lang.String aVersion)
           
 java.util.ListIterator iterChildren()
           
 java.lang.String lookupNamespacePrefix(java.lang.String aNamespaceUri)
           
 java.lang.String lookupNamespaceURI(java.lang.String aPrefix)
           
 void normalize()
          Puts all Text nodes in the full depth of the sub-tree underneath this Node, including attribute nodes, into a "normal" form where only structure (e.g., elements, comments, processing instructions, CDATA sections, and entity references) separates Text nodes, i.e., there are neither adjacent Text nodes nor empty Text nodes.
 org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild)
           
 org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild, org.w3c.dom.Node oldChild)
           
 void restoreTextContent(ITextContentMemento aMemento)
           
 ITextContentMemento saveTextContent()
           
 void setChildNodes(IDomNodeList aNodeList)
           
 void setLocation(ILocation aLocation)
           
 void setPrefixToNamespaceMapping(java.util.Map aMap)
           
 void setTextContent(ITextContentProvider aTextContentProvider)
           
 void setTextContent(java.lang.String aString)
           
protected  void visitChildren(IDomVisitor aVisitor)
           
 
Methods inherited from class org.jbind.xml.dom3.core.DomObject
checkMutability, checkOwnerDocument, getOwnerDocument, isReadOnly
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jbind.xml.dom3.types.IDomNode
getTextContent
 
Methods inherited from interface org.w3c.dom.Node
cloneNode, getAttributes, getLocalName, getNamespaceURI, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getPrefix, hasAttributes, setNodeValue, setPrefix
 
Methods inherited from interface org.jbind.xml.dom3.types.IDomObject
getOwnerDocument, isReadOnly
 

Field Detail

myParentNode

protected DomNode myParentNode
(required). The parent of this node. All nodes, except Attr, Document, DocumentFragment, Entity, and Notation may have a parent. However, if a node has just been created and not yet added to the tree, or if it has been removed from the tree, this is null.


myChildNodes

protected IDomNodeList myChildNodes
A NodeList that contains all children of this node. If there are no children, this is a NodeList containing no nodes.

Constructor Detail

DomNode

public DomNode(IDomDocument aDocument)

DomNode

protected DomNode(IDomNode aDomNode,
                  boolean aDeep)
Method Detail

collectTextContent

protected static final void collectTextContent(IDomNodeList aDomNodeList,
                                               StrBuffer aStrBuffer)
Recursively collects the text content of the nodes in the specified node list.


collectTextContent

protected static final java.lang.String collectTextContent(IDomNodeList aDomNodeList)

doCloneChildNodes

protected abstract IDomNodeList doCloneChildNodes(IDomNodeList aDomNodeList,
                                                  boolean aDeep)
Hook method for cloning the child nodes.


getPreviousSibling

public org.w3c.dom.Node getPreviousSibling()
Specified by:
getPreviousSibling in interface org.w3c.dom.Node

getNextSibling

public org.w3c.dom.Node getNextSibling()
Specified by:
getNextSibling in interface org.w3c.dom.Node

hasChildNodes

public boolean hasChildNodes()
Specified by:
hasChildNodes in interface org.w3c.dom.Node

removeChild

public org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild)
                             throws DomException
Specified by:
removeChild in interface org.w3c.dom.Node
Throws:
DomException

appendChild

public org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild)
                             throws DomException
Specified by:
appendChild in interface org.w3c.dom.Node
Throws:
DomException

insertBefore

public org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild,
                                     org.w3c.dom.Node refChild)
                              throws DomException
Specified by:
insertBefore in interface org.w3c.dom.Node
Throws:
DomException

insertAfter

public org.w3c.dom.Node insertAfter(org.w3c.dom.Node newChild,
                                    org.w3c.dom.Node refChild)
                             throws DomException
Specified by:
insertAfter in interface IDomNode
Throws:
DomException

replaceChild

public org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild,
                                     org.w3c.dom.Node oldChild)
                              throws DomException
Specified by:
replaceChild in interface org.w3c.dom.Node
Throws:
DomException

getChildNodes

public org.w3c.dom.NodeList getChildNodes()
Specified by:
getChildNodes in interface org.w3c.dom.Node

setChildNodes

public void setChildNodes(IDomNodeList aNodeList)

getParentNode

public org.w3c.dom.Node getParentNode()
Specified by:
getParentNode in interface org.w3c.dom.Node

getFirstChild

public org.w3c.dom.Node getFirstChild()
Specified by:
getFirstChild in interface org.w3c.dom.Node

getLastChild

public org.w3c.dom.Node getLastChild()
Specified by:
getLastChild in interface org.w3c.dom.Node

getChildByClass

protected org.w3c.dom.Node getChildByClass(java.lang.Class aClass)

normalize

public void normalize()
Puts all Text nodes in the full depth of the sub-tree underneath this Node, including attribute nodes, into a "normal" form where only structure (e.g., elements, comments, processing instructions, CDATA sections, and entity references) separates Text nodes, i.e., there are neither adjacent Text nodes nor empty Text nodes. This can be used to ensure that the DOM view of a document is the same as if it were saved and re-loaded, and is useful when operations (such as XPointer lookups) that depend on a particular document tree structure are to be used.In cases where the document contains CDATASections, the normalize operation alone may not be sufficient, since XPointers do not differentiate between Text nodes and CDATASection nodes.

Specified by:
normalize in interface org.w3c.dom.Node

isSupported

public boolean isSupported(java.lang.String aFeature,
                           java.lang.String aVersion)
Specified by:
isSupported in interface org.w3c.dom.Node

getBaseURI

public java.lang.String getBaseURI()

compareTreePosition

public short compareTreePosition(org.w3c.dom.Node other)

isSameNode

public boolean isSameNode(org.w3c.dom.Node aNode)

isEqualNode

public boolean isEqualNode(org.w3c.dom.Node aNode,
                           boolean aDeep)

lookupNamespacePrefix

public java.lang.String lookupNamespacePrefix(java.lang.String aNamespaceUri)

getNamespaceForPrefix

public java.lang.String getNamespaceForPrefix(java.lang.String aPrefix)

getPrefixForNamespace

public java.lang.String getPrefixForNamespace(java.lang.String aNamespace,
                                              boolean aCreate)

lookupNamespaceURI

public java.lang.String lookupNamespaceURI(java.lang.String aPrefix)
Specified by:
lookupNamespaceURI in interface IDomNode

getAncestor

protected org.w3c.dom.Node getAncestor()
Gets the parent or owner element.


getInterface

public org.w3c.dom.Node getInterface(java.lang.String aFeature)

getUserData

public java.lang.Object getUserData(java.lang.String aKey)

accept

public final void accept(IDomVisitor aVisitor)
Specified by:
accept in interface IDomNode

doBeforeAccept

protected abstract void doBeforeAccept(IDomVisitor aVisitor)

doAfterAccept

protected abstract void doAfterAccept(IDomVisitor aVisitor)

visitChildren

protected final void visitChildren(IDomVisitor aVisitor)

getLocation

public ILocation getLocation()
Specified by:
getLocation in interface IHasLocation

setLocation

public void setLocation(ILocation aLocation)
Specified by:
setLocation in interface IDomNode

addText

public ITextImpl addText(java.lang.String aText,
                         ILocation aLocation)

addElement

public IElementImpl addElement(java.lang.String aNamespace,
                               java.lang.String aQName,
                               java.util.Map aPrefixMappings,
                               ILocation aLocation)

addElement

public IElementImpl addElement(java.lang.String aNamespace,
                               java.lang.String aQName)

getParentImpl

public IImplContainer getParentImpl()

setTextContent

public void setTextContent(ITextContentProvider aTextContentProvider)
Specified by:
setTextContent in interface IDomNode

setTextContent

public void setTextContent(java.lang.String aString)
Specified by:
setTextContent in interface IDomNode

saveTextContent

public ITextContentMemento saveTextContent()

restoreTextContent

public void restoreTextContent(ITextContentMemento aMemento)

setPrefixToNamespaceMapping

public void setPrefixToNamespaceMapping(java.util.Map aMap)
Specified by:
setPrefixToNamespaceMapping in interface IDomNode

iterChildren

public java.util.ListIterator iterChildren()

getNbChildren

public int getNbChildren()

getNonDefaultedNbChildren

public int getNonDefaultedNbChildren()

getChild

public IImpl getChild(int anIndex)

getPrefixToNamespaceMapping

public java.util.Map getPrefixToNamespaceMapping()