gnu.xml.dom

Class DomElement

public class DomElement extends DomNsNode implements Element

"Element" implementation.

Version: $Date: 2001/11/20 04:53:46 $

Author: David Brownell

Constructor Summary
protected DomElement(Document owner, String namespaceURI, String name)
Constructs an Element node associated with the specified document.
Method Summary
Objectclone()
Shallow clone of the element, except that associated attributes are (deep) cloned.
StringgetAttribute(String name)
DOM L1 Returns the value of the specified attribute, or an empty string.
AttrgetAttributeNode(String name)
DOM L1 Returns the appropriate attribute node; the name is the nodeName property of the attribute.
AttrgetAttributeNodeNS(String namespace, String localPart)
DOM L2 Returns the appropriate attribute node; the name combines the namespace name and the local part.
StringgetAttributeNS(String namespaceURI, String local)
DOM L2 Returns the value of the specified attribute, or an empty string.
NamedNodeMapgetAttributes()
DOM L1 Returns the element's attributes
shortgetNodeType()
DOM L1 Returns the constant ELEMENT_NODE.
StringgetTagName()
DOM L1 Returns the element name (same as getNodeName).
booleanhasAttribute(String name)
DOM L2 Returns true if the element has an attribute with the specified name (specified or DTD defaulted).
booleanhasAttributeNS(String namespaceURI, 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(String name)
DOM L1 Removes the appropriate attribute node.
AttrremoveAttributeNode(Attr node)
DOM L1 Removes the appropriate attribute node; the name is the nodeName property of the attribute.
voidremoveAttributeNS(String namespace, String localPart)
DOM L2 Removes the appropriate attribute node; the name combines the namespace name and the local part.
voidsetAttribute(String name, String value)
DOM L1 Modifies an existing attribute to have the specified value, or creates a new one with that value.
AttrsetAttributeNode(Attr attr)
DOM L1 Stores the specified attribute, optionally overwriting any existing one with that name.
AttrsetAttributeNodeNS(Attr attr)
DOM L2 Stores the specified attribute, optionally overwriting any existing one with that name.
voidsetAttributeNS(String uri, String aname, String value)
DOM L2 Modifies an existing attribute to have the specified value, or creates a new one with that value.

Constructor Detail

DomElement

protected DomElement(Document owner, String namespaceURI, 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: owner The document with which this node is associated namespaceURI Combined with the local part of the name, this is used to uniquely identify a type of element name Name of this element, which may include a prefix

Method Detail

clone

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

getAttribute

public String getAttribute(String name)
DOM L1 Returns the value of the specified attribute, or an empty string.

getAttributeNode

public Attr getAttributeNode(String name)
DOM L1 Returns the appropriate attribute node; the name is the nodeName property of the attribute.

getAttributeNodeNS

public Attr getAttributeNodeNS(String namespace, String localPart)
DOM L2 Returns the appropriate attribute node; the name combines the namespace name and the local part.

getAttributeNS

public String getAttributeNS(String namespaceURI, String local)
DOM L2 Returns the value of the specified attribute, or an empty string.

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(String name)
DOM L2 Returns true if the element has an attribute with the specified name (specified or DTD defaulted).

hasAttributeNS

public boolean hasAttributeNS(String namespaceURI, String local)
DOM L2 Returns true if the element has an attribute with the specified name (specified or DTD defaulted).

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(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.

removeAttributeNode

public Attr removeAttributeNode(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.

removeAttributeNS

public void removeAttributeNS(String namespace, 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.

setAttribute

public void setAttribute(String name, 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.

setAttributeNode

public Attr setAttributeNode(Attr attr)
DOM L1 Stores the specified attribute, optionally overwriting any existing one with that name.

setAttributeNodeNS

public Attr setAttributeNodeNS(Attr attr)
DOM L2 Stores the specified attribute, optionally overwriting any existing one with that name.

setAttributeNS

public void setAttributeNS(String uri, String aname, String value)
DOM L2 Modifies an existing attribute to have the specified value, or creates a new one with that value.

Source code is under GPL (with library exception) in the JAXP project at http://www.gnu.org/software/classpathx/jaxp
This documentation was derived from that source code on 2013-01-12.