BEA Systems, Inc.

com.beasys.commerce.util.dom
Class ElementImpl

java.lang.Object
  |
  +--com.beasys.commerce.util.dom.DOMBase
        |
        +--com.beasys.commerce.util.dom.NodeImpl
              |
              +--com.beasys.commerce.util.dom.ElementImpl

public class ElementImpl
extends NodeImpl
implements org.w3c.dom.Element

An implementation of the W3C's DOM Element object.

See Also:
Serialized Form

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
ElementImpl(org.w3c.dom.Document doc, org.w3c.dom.Node parent, java.lang.String tagName)
          Constructor.
 
Method Summary
 org.w3c.dom.Node cloneNode()
          Clone this node.
protected  short[] getAllowableChildrenTypes()
          Get the children types that can added to an element.
 java.lang.String getAttribute(java.lang.String name)
          Get the attribute by name.
 org.w3c.dom.Attr getAttributeNode(java.lang.String name)
          Get the attribute node by name.
 org.w3c.dom.NamedNodeMap getAttributes()
          Get the attributes.
 org.w3c.dom.NodeList getElementsByTagName(java.lang.String name)
          Get a list of all descendant Elements with the given name, in preorder traversal.
 java.lang.String getNodeName()
          Get the node name.
 short getNodeType()
          Return Node.ELEMENT_NODE.
 java.lang.String getTagName()
          Get the tag name.
 void normalize()
          Normalize Text nodes under us.
 void removeAttribute(java.lang.String name)
          Remove the attribute with give name.
 org.w3c.dom.Attr removeAttributeNode(org.w3c.dom.Attr attr)
          Remove the given attribute node.
 void setAttribute(java.lang.String name, java.lang.String value)
          Set the named attribute to the given value.
 org.w3c.dom.Attr setAttributeNode(org.w3c.dom.Attr attr)
          Adds the given attribute.
 void setTagName(java.lang.String tagName)
          Set the tag name.
 
Methods inherited from class com.beasys.commerce.util.dom.NodeImpl
allowsChildren, appendChild, appendChildren, checkAllowChild, cloneNode, getChildNodes, getFirstChild, getLastChild, getNextSibling, getNodeType, getNodeValue, getParentNode, getPreviousSibling, hasChildNodes, insertBefore, insertChildrenBefore, isAncestor, removeChild, replaceChild, setNodeValue, setParentNode
 
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

ElementImpl

public ElementImpl(org.w3c.dom.Document doc,
                   org.w3c.dom.Node parent,
                   java.lang.String tagName)
Constructor.
Parameters:
doc - the document.
parent - the parent node.
tagName - the tag name.
Method Detail

cloneNode

public org.w3c.dom.Node cloneNode()
Clone this node.
Overrides:
cloneNode in class NodeImpl

getNodeType

public short getNodeType()
Return Node.ELEMENT_NODE.
Overrides:
getNodeType in class NodeImpl

getAllowableChildrenTypes

protected short[] getAllowableChildrenTypes()
Get the children types that can added to an element.
Overrides:
getAllowableChildrenTypes in class NodeImpl
Tags copied from class: NodeImpl
Returns:
an array of nodeTypes, or null for no children allowed.

getNodeName

public java.lang.String getNodeName()
Get the node name.

For Elements, the node name is the tag name.

Overrides:
getNodeName in class NodeImpl
See Also:
getTagName()

getTagName

public java.lang.String getTagName()
Get the tag name.
Specified by:
getTagName in interface org.w3c.dom.Element

setTagName

public void setTagName(java.lang.String tagName)
Set the tag name.

getAttributes

public org.w3c.dom.NamedNodeMap getAttributes()
Get the attributes.
Overrides:
getAttributes in class NodeImpl
Tags copied from class: NodeImpl
Returns:
null.

getAttribute

public java.lang.String getAttribute(java.lang.String name)
Get the attribute by name.
Specified by:
getAttribute in interface org.w3c.dom.Element
See Also:
getAttributeNode(java.lang.String)

getAttributeNode

public org.w3c.dom.Attr getAttributeNode(java.lang.String name)
Get the attribute node by name.
Specified by:
getAttributeNode in interface org.w3c.dom.Element

getElementsByTagName

public org.w3c.dom.NodeList getElementsByTagName(java.lang.String name)
Get a list of all descendant Elements with the given name, in preorder traversal.
Specified by:
getElementsByTagName in interface org.w3c.dom.Element
See Also:
DocumentImpl.getElementsByTagName(java.lang.String)

removeAttribute

public void removeAttribute(java.lang.String name)
                     throws org.w3c.dom.DOMException
Remove the attribute with give name.
Specified by:
removeAttribute in interface org.w3c.dom.Element
Throws:
org.w3c.dom.DOMException - thrown if the element is read-only.
See Also:
removeAttributeNode(org.w3c.dom.Attr)

removeAttributeNode

public org.w3c.dom.Attr removeAttributeNode(org.w3c.dom.Attr attr)
                                     throws org.w3c.dom.DOMException
Remove the given attribute node.
Specified by:
removeAttributeNode in interface org.w3c.dom.Element
Returns:
the removed attribute.
Throws:
org.w3c.dom.DOMException - thrown if the given attribute cannot be removed.

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.String value)
                  throws org.w3c.dom.DOMException
Set the named attribute to the given value.
Specified by:
setAttribute in interface org.w3c.dom.Element
Parameters:
name - the attribute name.
value - the attribute value.
Throws:
org.w3c.dom.DOMException - thrown if the attribute cannot be set.
See Also:
setAttributeNode(org.w3c.dom.Attr)

setAttributeNode

public org.w3c.dom.Attr setAttributeNode(org.w3c.dom.Attr attr)
                                  throws org.w3c.dom.DOMException
Adds the given attribute.
Specified by:
setAttributeNode in interface org.w3c.dom.Element
Parameters:
attr - the attribute.
Returns:
the attribute being replaced or null.
Throws:
org.w3c.dom.DOMException - thrown if the attribute cannot be set.

normalize

public void normalize()
Normalize Text nodes under us.
Specified by:
normalize in interface org.w3c.dom.Element
See Also:
DocumentImpl.normalize(org.w3c.dom.Node)

BEA Systems, Inc.

Copyright © 2000 BEA Systems, Inc. All Rights Reserved