Index (Frames) | Index (No Frames) | Package | Package Tree | Tree
gnu.xml.dom

Class DomElement

java.lang.Object
|
+--gnu.xml.dom.DomNode
   |
   +--gnu.xml.dom.DomNsNode
      |
      +--gnu.xml.dom.DomElement

All Implemented Interfaces:

Element, Node, NodeList, EventTarget, DocumentEvent, Cloneable


public class DomElement

extends DomNsNode

implements Element

"Element" implementation.

Author:

Constructor Summary

DomElement(org.w3c.dom.Document owner, java.lang.String namespaceURI, java.lang.String name)

Constructs an Element node associated with the specified document.

Method Summary

java.lang.Objectclone()

Shallow clone of the element, except that associated attributes are (deep) cloned.
java.lang.StringgetAttribute(java.lang.String name)

DOM L1 Returns the value of the specified attribute, or an empty string.
java.lang.StringgetAttributeNS(java.lang.String namespaceURI, java.lang.String local)

DOM L2 Returns the value of the specified attribute, or an empty string.
org.w3c.dom.AttrgetAttributeNode(java.lang.String name)

DOM L1 Returns the appropriate attribute node; the name is the nodeName property of the attribute.
org.w3c.dom.AttrgetAttributeNodeNS(java.lang.String namespace, java.lang.String localPart)

DOM L2 Returns the appropriate attribute node; the name combines the namespace name and the local part.
org.w3c.dom.NamedNodeMapgetAttributes()

DOM L1 Returns the element's attributes
shortgetNodeType()

DOM L1 Returns the constant ELEMENT_NODE.
java.lang.StringgetTagName()

DOM L1 Returns the element name (same as getNodeName).
booleanhasAttribute(java.lang.String name)

DOM L2 Returns true if the element has an attribute with the specified name (specified or DTD defaulted).
booleanhasAttributeNS(java.lang.String namespaceURI, java.lang.String local)

DOM L2 Returns true if the element has an attribute with the specified name (specified or DTD defaulted).
booleanhasAttributes()

DOM L2> Returns true iff this is an element node with attributes.
voidmakeReadonly()

Marks this element, its children, and its associated attributes as readonly.
voidremoveAttribute(java.lang.String name)

DOM L1 Removes the appropriate attribute node.
voidremoveAttributeNS(java.lang.String namespace, java.lang.String localPart)

DOM L2 Removes the appropriate attribute node; the name combines the namespace name and the local part.
org.w3c.dom.AttrremoveAttributeNode(org.w3c.dom.Attr node)

DOM L1 Removes the appropriate attribute node; the name is the nodeName property of the attribute.
voidsetAttribute(java.lang.String name, java.lang.String value)

DOM L1 Modifies an existing attribute to have the specified value, or creates a new one with that value.
voidsetAttributeNS(java.lang.String uri, java.lang.String aname, java.lang.String value)

DOM L2 Modifies an existing attribute to have the specified value, or creates a new one with that value.
org.w3c.dom.AttrsetAttributeNode(org.w3c.dom.Attr attr)

DOM L1 Stores the specified attribute, optionally overwriting any existing one with that name.
org.w3c.dom.AttrsetAttributeNodeNS(org.w3c.dom.Attr attr)

DOM L2 Stores the specified attribute, optionally overwriting any existing one with that name.

Constructor Details

DomElement

protected DomElement(org.w3c.dom.Document owner, java.lang.String namespaceURI, java.lang.String name)

Constructs an Element node associated with the specified document.

This constructor should only be invoked by a Document as part of its createElement functionality, or through a subclass which is similarly used in a "Sub-DOM" style layer.

Parameters:


Method Details

clone

public Object clone()

Shallow clone of the element, except that associated attributes are (deep) cloned.


getAttribute

public String getAttribute(java.lang.String name)

DOM L1 Returns the value of the specified attribute, or an empty string.

Parameters:


getAttributeNS

public String getAttributeNS(java.lang.String namespaceURI, java.lang.String local)

DOM L2 Returns the value of the specified attribute, or an empty string.

Parameters:


getAttributeNode

public Attr getAttributeNode(java.lang.String name)

DOM L1 Returns the appropriate attribute node; the name is the nodeName property of the attribute.

Parameters:


getAttributeNodeNS

public Attr getAttributeNodeNS(java.lang.String namespace, java.lang.String localPart)

DOM L2 Returns the appropriate attribute node; the name combines the namespace name and the local part.

Parameters:


getAttributes

public NamedNodeMap getAttributes()

DOM L1 Returns the element's attributes


getNodeType

public final short getNodeType()

DOM L1 Returns the constant ELEMENT_NODE.


getTagName

public final String getTagName()

DOM L1 Returns the element name (same as getNodeName).


hasAttribute

public boolean hasAttribute(java.lang.String name)

DOM L2 Returns true if the element has an attribute with the specified name (specified or DTD defaulted).

Parameters:


hasAttributeNS

public boolean hasAttributeNS(java.lang.String namespaceURI, java.lang.String local)

DOM L2 Returns true if the element has an attribute with the specified name (specified or DTD defaulted).

Parameters:


hasAttributes

public boolean hasAttributes()

DOM L2> Returns true iff this is an element node with attributes.


makeReadonly

public void makeReadonly()

Marks this element, its children, and its associated attributes as readonly.


removeAttribute

public void removeAttribute(java.lang.String name)

DOM L1 Removes the appropriate attribute node. If there is no such node, this is (bizarrely enough) a NOP so you won't see exceptions if your code deletes non-existent attributes.

Note that since there is no portable way for DOM to record DTD information, default values for attributes will never be provided automatically.

Parameters:


removeAttributeNS

public void removeAttributeNS(java.lang.String namespace, java.lang.String localPart)

DOM L2 Removes the appropriate attribute node; the name combines the namespace name and the local part.

Note that since there is no portable way for DOM to record DTD information, default values for attributes will never be provided automatically.

Parameters:


removeAttributeNode

public Attr removeAttributeNode(org.w3c.dom.Attr node)

DOM L1 Removes the appropriate attribute node; the name is the nodeName property of the attribute.

Note that since there is no portable way for DOM to record DTD information, default values for attributes will never be provided automatically.

Parameters:


setAttribute

public void setAttribute(java.lang.String name, java.lang.String value)

DOM L1 Modifies an existing attribute to have the specified value, or creates a new one with that value. The name used is the nodeName value.

Parameters:


setAttributeNS

public void setAttributeNS(java.lang.String uri, java.lang.String aname, java.lang.String value)

DOM L2 Modifies an existing attribute to have the specified value, or creates a new one with that value.

Parameters:


setAttributeNode

public Attr setAttributeNode(org.w3c.dom.Attr attr)

DOM L1 Stores the specified attribute, optionally overwriting any existing one with that name.

Parameters:


setAttributeNodeNS

public Attr setAttributeNodeNS(org.w3c.dom.Attr attr)

DOM L2 Stores the specified attribute, optionally overwriting any existing one with that name.

Parameters: