Overview | Package | Class | Use | Tree | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## gnu.xml.dom
Class DomElement

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

All Implemented Interfaces:
  java.lang.Cloneable, DocumentEvent, Element, EventTarget, Node, NodeList

public class DomElement
extends DomNsNode
implements Element

"Element" implementation.

Version:
  $Date: 2001/11/20 04:53:46 $
Author:
  David Brownell

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
`protected` | `DomElement(Document owner, java.lang.String namespaceURI, java.lang.String name)` Constructs an Element node associated with the specified document.

Method Summary
`java.lang.Object` | `clone()` Shallow clone of the element, except that associated attributes are (deep) cloned.
`java.lang.String` | `getAttribute(java.lang.String name)` DOM L1 Returns the value of the specified attribute, or an empty string.
`Attr` | `getAttributeNode(java.lang.String name)` DOM L1 Returns the appropriate attribute node; the name is the nodeName property of the attribute.
`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.
`java.lang.String` | `getAttributeNS(java.lang.String namespaceURI, java.lang.String local)` DOM L2 Returns the value of the specified attribute, or an empty string.
`NamedNodeMap` | `getAttributes()` DOM L1 Returns the element's attributes
`short` | `getNodeType()` DOM L1 Returns the constant ELEMENT_NODE.
`java.lang.String` | `getTagName()` DOM L1 Returns the element name (same as getNodeName).
`boolean` | `hasAttribute(java.lang.String name)` DOM L2 Returns true if the element has an attribute with the specified name (specified or DTD defaulted).
`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).
`boolean` | `hasAttributes()` DOM L2> Returns true iff this is an element node with attributes.
`void` | `makeReadonly()` Marks this element, its children, and its associated attributes as readonly.
`void` | `removeAttribute(java.lang.String name)` DOM L1 Removes the appropriate attribute node.
`Attr` | `removeAttributeNode(Attr node)` DOM L1 Removes the appropriate attribute node; the name is the nodeName property of the attribute.
`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.
`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.
`Attr` | `setAttributeNode(Attr attr)` DOM L1 Stores the specified attribute, optionally overwriting any existing one with that name.
`Attr` | `setAttributeNodeNS(Attr attr)` DOM L2 Stores the specified attribute, optionally overwriting any existing one with that name.
`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.

Methods inherited from class gnu.xml.dom.DomNsNode
`getLocalName, getNamespaceURI, getNodeName, getPrefix, setPrefix`

Methods inherited from class gnu.xml.dom.DomNode
`addEventListener, appendChild, cloneNode, compact, createEvent, dispatchEvent, getChildNodes, getElementsByTagName, getElementsByTagNameNS, getFirstChild, getLastChild, getLength, getNextSibling, getNodeValue, getOwnerDocument, getParentNode, getPreviousSibling, hasChildNodes, insertBefore, isReadonly, isSupported, item, nameAndTypeEquals, normalize, removeChild, removeEventListener, replaceChild, setNodeValue, trimToSize`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.w3c.dom.Element
`getElementsByTagName, getElementsByTagNameNS`

Methods inherited from interface org.w3c.dom.Node
`appendChild, cloneNode, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, hasChildNodes, insertBefore, isSupported, normalize, removeChild, replaceChild, setNodeValue, setPrefix`

Constructor Detail

### DomElement

    protected DomElement(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:
    `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

### getAttributes

    public NamedNodeMap getAttributes()

  DOM L1 Returns the element's attributes
  Specified by:
    `getAttributes` in interface `Node`
  Overrides:
    `getAttributes` in class `DomNode`

### hasAttributes

    public boolean hasAttributes()

  DOM L2> Returns true iff this is an element node with attributes.
  Specified by:
    `hasAttributes` in interface `Node`
  Overrides:
    `hasAttributes` in class `DomNode`
  Following copied from interface: `org.w3c.dom.Node`
  Returns:
    `true` if this node has any attributes, `false` otherwise.

### clone

    public java.lang.Object clone()

  Shallow clone of the element, except that associated attributes are (deep) cloned.
  Overrides:
    `clone` in class `DomNode`

### makeReadonly

    public void makeReadonly()

  Marks this element, its children, and its associated attributes as readonly.
  Overrides:
    `makeReadonly` in class `DomNode`

### getTagName

    public final java.lang.String getTagName()

  DOM L1 Returns the element name (same as getNodeName).
  Specified by:
    `getTagName` in interface `Element`

### getNodeType

    public final short getNodeType()

  DOM L1 Returns the constant ELEMENT_NODE.
  Specified by:
    `getNodeType` in interface `Node`

### getAttribute

    public java.lang.String getAttribute(java.lang.String name)

  DOM L1 Returns the value of the specified attribute, or an empty string.
  Specified by:
    `getAttribute` in interface `Element`
  Following copied from interface: `org.w3c.dom.Element`
  Parameters:
    `name` - The name of the attribute to retrieve.
  Returns:
    The `Attr` value as a string, or the empty string if that attribute does not have a specified or default value.

### 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).
  Specified by:
    `hasAttribute` in interface `Element`
  Following copied from interface: `org.w3c.dom.Element`
  Parameters:
    `name` - The name of the attribute to look for.
  Returns:
    `true` if an attribute with the given name is specified on this element or has a default value, `false` otherwise.

### 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).
  Specified by:
    `hasAttributeNS` in interface `Element`
  Following copied from interface: `org.w3c.dom.Element`
  Parameters:
    `namespaceURI` - The namespace URI of the attribute to look for.
    `localName` - The local name of the attribute to look for.
  Returns:
    `true` if an attribute with the given local name and namespace URI is specified or has a default value on this element, `false` otherwise.

### getAttributeNS

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

  DOM L2 Returns the value of the specified attribute, or an empty string.
  Specified by:
    `getAttributeNS` in interface `Element`
  Following copied from interface: `org.w3c.dom.Element`
  Parameters:
    `namespaceURI` - The namespace URI of the attribute to retrieve.
    `localName` - The local name of the attribute to retrieve.
  Returns:
    The `Attr` value as a string, or the empty string if that attribute does not have a specified or default value.

### getAttributeNode

    public Attr getAttributeNode(java.lang.String name)

  DOM L1 Returns the appropriate attribute node; the name is the nodeName property of the attribute.
  Specified by:
    `getAttributeNode` in interface `Element`
  Following copied from interface: `org.w3c.dom.Element`
  Parameters:
    `name` - The name (`nodeName`) of the attribute to retrieve.
  Returns:
    The `Attr` node with the specified name ( `nodeName`) or `null` if there is no such attribute.

### 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.
  Specified by:
    `getAttributeNodeNS` in interface `Element`
  Following copied from interface: `org.w3c.dom.Element`
  Parameters:
    `namespaceURI` - The namespace URI of the attribute to retrieve.
    `localName` - The local name of the attribute to retrieve.
  Returns:
    The `Attr` node with the specified attribute local name and namespace URI or `null` if there is no such attribute.

### 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.
  Specified by:
    `setAttribute` in interface `Element`
  Following copied from interface: `org.w3c.dom.Element`
  Parameters:
    `name` - The name of the attribute to create or alter.
    `value` - Value to set in string form.
  Throws:
    `DOMException` - INVALID_CHARACTER_ERR: Raised if the specified name contains an illegal character.
    NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

### 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.
  Specified by:
    `setAttributeNS` in interface `Element`
  Following copied from interface: `org.w3c.dom.Element`
  Parameters:
    `namespaceURI` - The namespace URI of the attribute to create or alter.
    `qualifiedName` - The qualified name of the attribute to create or alter.
    `value` - The value to set in string form.
  Throws:
    `DOMException` - INVALID_CHARACTER_ERR: Raised if the specified qualified name contains an illegal character, per the XML 1.0 specification .
    NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
    NAMESPACE_ERR: Raised if the `qualifiedName` is malformed per the Namespaces in XML specification, if the `qualifiedName` has a prefix and the `namespaceURI` is `null`, if the `qualifiedName` has a prefix that is "xml" and the `namespaceURI` is different from " http://www.w3.org/XML/1998/namespace", or if the `qualifiedName`, or its prefix, is "xmlns" and the `namespaceURI` is different from " http://www.w3.org/2000/xmlns/".
    NOT_SUPPORTED_ERR: Always thrown if the current document does not support the `"XML"` feature, since namespaces were defined by XML.

### setAttributeNode

    public Attr setAttributeNode(Attr attr)

  DOM L1 Stores the specified attribute, optionally overwriting any existing one with that name.
  Specified by:
    `setAttributeNode` in interface `Element`
  Following copied from interface: `org.w3c.dom.Element`
  Parameters:
    `newAttr` - The `Attr` node to add to the attribute list.
  Returns:
    If the `newAttr` attribute replaces an existing attribute, the replaced `Attr` node is returned, otherwise `null` is returned.
  Throws:
    `DOMException` - WRONG_DOCUMENT_ERR: Raised if `newAttr` was created from a different document than the one that created the element.
    NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
    INUSE_ATTRIBUTE_ERR: Raised if `newAttr` is already an attribute of another `Element` object. The DOM user must explicitly clone `Attr` nodes to re-use them in other elements.

### setAttributeNodeNS

    public Attr setAttributeNodeNS(Attr attr)

  DOM L2 Stores the specified attribute, optionally overwriting any existing one with that name.
  Specified by:
    `setAttributeNodeNS` in interface `Element`
  Following copied from interface: `org.w3c.dom.Element`
  Parameters:
    `newAttr` - The `Attr` node to add to the attribute list.
  Returns:
    If the `newAttr` attribute replaces an existing attribute with the same local name and namespace URI, the replaced `Attr` node is returned, otherwise `null` is returned.
  Throws:
    `DOMException` - WRONG_DOCUMENT_ERR: Raised if `newAttr` was created from a different document than the one that created the element.
    NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
    INUSE_ATTRIBUTE_ERR: Raised if `newAttr` is already an attribute of another `Element` object. The DOM user must explicitly clone `Attr` nodes to re-use them in other elements.
    NOT_SUPPORTED_ERR: Always thrown if the current document does not support the `"XML"` feature, since namespaces were defined by XML.

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

  Specified by:
    `removeAttribute` in interface `Element`
  Following copied from interface: `org.w3c.dom.Element`
  Parameters:
    `name` - The name of the attribute to remove.
  Throws:
    `DOMException` - NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

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

  Specified by:
    `removeAttributeNode` in interface `Element`
  Following copied from interface: `org.w3c.dom.Element`
  Parameters:
    `oldAttr` - The `Attr` node to remove from the attribute list.
  Returns:
    The `Attr` node that was removed.
  Throws:
    `DOMException` - NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
    NOT_FOUND_ERR: Raised if `oldAttr` is not an attribute of the element.

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

  Specified by:
    `removeAttributeNS` in interface `Element`
  Following copied from interface: `org.w3c.dom.Element`
  Parameters:
    `namespaceURI` - The namespace URI of the attribute to remove.
    `localName` - The local name of the attribute to remove.
  Throws:
    `DOMException` - NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

Overview | Package | Class | Use | Tree | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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 2001-11-20.