|
BEA Systems, Inc. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.beasys.commerce.util.dom.DOMBase | +--com.beasys.commerce.util.dom.NodeImpl
A base class implementation of the W3C's DOM Node object.
This provides support for child nodes and a parent node.
Subclasses need to override the cloneNode()
,
getNodeType()
, getNodeName()
; subclasses might choose to
override getAllowableChildrenTypes()
, * getNodeValue()
,
and setNodeValue(java.lang.String)
. Elements should override
getAttributes()
to provide support for attributes.
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 | |
NodeImpl(org.w3c.dom.Document document,
org.w3c.dom.Node parent)
Constructor. |
Method Summary | |
protected boolean |
allowsChildren()
Tell if this node can generally have children. |
org.w3c.dom.Node |
appendChild(org.w3c.dom.Node child)
Append a new child node to the end of children node list. |
protected org.w3c.dom.Node |
appendChildren(org.w3c.dom.Node node)
Append all the children of a node to this node. |
protected void |
checkAllowChild(org.w3c.dom.Node child)
Check if the node allows for adding the given child. |
abstract org.w3c.dom.Node |
cloneNode()
Clone yourself, including attributes, but not children. |
org.w3c.dom.Node |
cloneNode(boolean deep)
Clone this node. |
protected short[] |
getAllowableChildrenTypes()
An array of the types of children Node's this node can have. |
org.w3c.dom.NamedNodeMap |
getAttributes()
Return the attributes of this node. |
org.w3c.dom.NodeList |
getChildNodes()
Return the children nodes of this node. |
org.w3c.dom.Node |
getFirstChild()
Get the first child node. |
org.w3c.dom.Node |
getLastChild()
Get the last child node. |
org.w3c.dom.Node |
getNextSibling()
Get the next sibling of this node. |
abstract java.lang.String |
getNodeName()
Get the node's name. |
abstract short |
getNodeType()
Get the node's type. |
static java.lang.String |
getNodeType(short type)
Get a string version of the node type. |
java.lang.String |
getNodeValue()
Get the node's value. |
org.w3c.dom.Node |
getParentNode()
Get the parent node. |
org.w3c.dom.Node |
getPreviousSibling()
Get the previous sibling of this node. |
boolean |
hasChildNodes()
Return if this has children nodes. |
org.w3c.dom.Node |
insertBefore(org.w3c.dom.Node newChild,
org.w3c.dom.Node refChild)
Insert a new child node in front of the given child node in our children node list. |
protected org.w3c.dom.Node |
insertChildrenBefore(org.w3c.dom.Node node,
org.w3c.dom.Node refChild)
Insert the given node's children in front of the given child node. |
protected boolean |
isAncestor(org.w3c.dom.Node node)
Check if the given node is an ancestor (up the parent nodes) of us. |
org.w3c.dom.Node |
removeChild(org.w3c.dom.Node child)
Remove the specified child node from children node list. |
org.w3c.dom.Node |
replaceChild(org.w3c.dom.Node newChild,
org.w3c.dom.Node oldChild)
Replace the specified child node with the new child node in our children node list. |
void |
setNodeValue(java.lang.String value)
Set the node's value. |
void |
setParentNode(org.w3c.dom.Node parentNode)
Set the parent node. |
Methods inherited from class com.beasys.commerce.util.dom.DOMBase |
checkOwnerDocument,
checkReadOnly,
getOwnerDocument,
isReadOnly,
setReadOnly |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public NodeImpl(org.w3c.dom.Document document, org.w3c.dom.Node parent)
document
- the document we're part of.parent
- our parent node.Method Detail |
public abstract org.w3c.dom.Node cloneNode()
This is different from cloneNode(boolean)
; this is always a shallow
clone.
protected short[] getAllowableChildrenTypes()
Subclasses that can have children Nodes should override this method to return an array of shorts of the nodeType's it can have as children (e.g. Node.ATTR_NODE, Node.ELEMENT_NODE, etc.).
This method must return the same thing each time.
protected boolean allowsChildren()
getAllowableChildrenTypes()
protected void checkAllowChild(org.w3c.dom.Node child) throws org.w3c.dom.DOMException
child
- the Node to add.getAllowableChildrenTypes()
,
isAncestor(org.w3c.dom.Node)
,
DOMBase.checkReadOnly()
,
DOMBase.checkOwnerDocument(org.w3c.dom.Node)
protected boolean isAncestor(org.w3c.dom.Node node)
node
- the node to check.public org.w3c.dom.Node appendChild(org.w3c.dom.Node child) throws org.w3c.dom.DOMException
child
- the new child node.protected org.w3c.dom.Node appendChildren(org.w3c.dom.Node node) throws org.w3c.dom.DOMException
When adding document fragments to a node, you actually are supposed to add the children of the document fragment.
node
- the Node.public org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild) throws org.w3c.dom.DOMException
newChild
- the child to add.refChild
- the child to add in front of.protected org.w3c.dom.Node insertChildrenBefore(org.w3c.dom.Node node, org.w3c.dom.Node refChild) throws org.w3c.dom.DOMException
node
- the node.refChild
- the child to add in front of.public org.w3c.dom.Node removeChild(org.w3c.dom.Node child) throws org.w3c.dom.DOMException
child
- the child to remove.public org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild, org.w3c.dom.Node oldChild) throws org.w3c.dom.DOMException
newChild
- the new child replacing the old child.oldChild
- the old child being replaced.public boolean hasChildNodes()
public org.w3c.dom.Node cloneNode(boolean deep)
deep
- true to also clone the children of this node.Object.clone()
public org.w3c.dom.NamedNodeMap getAttributes()
Element's should override to return a NamedNodeMap.
public org.w3c.dom.NodeList getChildNodes()
public org.w3c.dom.Node getFirstChild()
public org.w3c.dom.Node getLastChild()
public org.w3c.dom.Node getNextSibling()
public org.w3c.dom.Node getPreviousSibling()
public abstract short getNodeType()
public abstract java.lang.String getNodeName()
This value is subclass specific; see the DOM documentation for further details.
public java.lang.String getNodeValue()
This value is subclass specific; see the DOM documentation for further details.
The method here returns null. Subclasses that have node values should override this method.
public void setNodeValue(java.lang.String value)
The implementation of this is subclass specific; see the DOM documentation for further details.
The method here does nothing. Subclasses that have node values should override this method.
public org.w3c.dom.Node getParentNode()
public void setParentNode(org.w3c.dom.Node parentNode)
parentNode
- the new parent node (can be null which means no
longer in a tree).public static java.lang.String getNodeType(short type)
|
BEA Systems, Inc. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |