org.apache.xerces.dom
Class AttributeMap

java.lang.Object
  extended by org.apache.xerces.dom.NamedNodeMapImpl
      extended by org.apache.xerces.dom.AttributeMap
All Implemented Interfaces:
java.io.Serializable, NamedNodeMap

public class AttributeMap
extends NamedNodeMapImpl

AttributeMap inherits from NamedNodeMapImpl and extends it to deal with the specifics of storing attributes. These are:

This class doesn't directly support mutation events, however, it notifies the document when mutations are performed so that the document class do so.

Version:
$Id: AttributeMap.java 449328 2006-09-23 22:58:23Z mrglavas $
See Also:
Serialized Form

Method Summary
 NamedNodeMapImpl cloneMap(NodeImpl ownerNode)
          Cloning a NamedNodeMap is a DEEP OPERATION; it always clones all the nodes contained in the map.
 Node removeNamedItem(java.lang.String name)
          Removes a node specified by name.
 Node removeNamedItemNS(java.lang.String namespaceURI, java.lang.String name)
          Introduced in DOM Level 2.
 Node setNamedItem(Node arg)
          Adds an attribute using its nodeName attribute.
 Node setNamedItemNS(Node arg)
          Adds an attribute using its namespaceURI and localName.
 
Methods inherited from class org.apache.xerces.dom.NamedNodeMapImpl
getLength, getNamedItem, getNamedItemNS, item, removeAll
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setNamedItem

public Node setNamedItem(Node arg)
                  throws DOMException
Adds an attribute using its nodeName attribute.

Specified by:
setNamedItem in interface NamedNodeMap
Overrides:
setNamedItem in class NamedNodeMapImpl
Parameters:
arg - An Attr node to store in this map.
Returns:
If the new Node replaces an existing node the replaced Node is returned, otherwise null is returned.
Throws:
DOMException - The exception description.
See Also:
NamedNodeMap.setNamedItem(org.w3c.dom.Node)

setNamedItemNS

public Node setNamedItemNS(Node arg)
                    throws DOMException
Adds an attribute using its namespaceURI and localName.

Specified by:
setNamedItemNS in interface NamedNodeMap
Overrides:
setNamedItemNS in class NamedNodeMapImpl
Parameters:
arg - A node to store in a named node map.
Returns:
If the new Node replaces an existing node the replaced Node is returned, otherwise null is returned.
Throws:
DOMException - WRONG_DOCUMENT_ERR: Raised if arg was created from a different document than the one that created this map.
NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
INUSE_ATTRIBUTE_ERR: Raised if arg is an Attr that is already an attribute of another Element object. The DOM user must explicitly clone Attr nodes to re-use them in other elements.
HIERARCHY_REQUEST_ERR: Raised if an attempt is made to add a node doesn't belong in this NamedNodeMap. Examples would include trying to insert something other than an Attr node into an Element's map of attributes, or a non-Entity node into the DocumentType's map of Entities.
NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML" and the language exposed through the Document does not support XML Namespaces (such as [HTML 4.01]).
See Also:
NamedNodeMap.setNamedItem(org.w3c.dom.Node)

removeNamedItem

public Node removeNamedItem(java.lang.String name)
                     throws DOMException
Description copied from interface: NamedNodeMap
Removes a node specified by name. When this map contains the attributes attached to an element, if the removed attribute is known to have a default value, an attribute immediately appears containing the default value as well as the corresponding namespace URI, local name, and prefix when applicable.

Specified by:
removeNamedItem in interface NamedNodeMap
Overrides:
removeNamedItem in class NamedNodeMapImpl
Parameters:
name - The nodeName of the node to remove.
Returns:
The node removed from this map if a node with such a name exists.
Throws:
DOMException - NOT_FOUND_ERR: Raised if there is no node named name in this map.
NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.

removeNamedItemNS

public Node removeNamedItemNS(java.lang.String namespaceURI,
                              java.lang.String name)
                       throws DOMException
Introduced in DOM Level 2.

Removes an attribute specified by local name and namespace URI.

Specified by:
removeNamedItemNS in interface NamedNodeMap
Overrides:
removeNamedItemNS in class NamedNodeMapImpl
Parameters:
namespaceURI - The namespace URI of the node to remove. When it is null or an empty string, this method behaves like removeNamedItem.
name - The local name of the node to remove. If the removed attribute is known to have a default value, an attribute immediately appears containing the default value.
Returns:
Node The node removed from the map if a node with such a local name and namespace URI exists.
Throws:
NOT_FOUND_ERR: - Raised if there is no node named name in the map.
DOMException - NOT_FOUND_ERR: Raised if there is no node with the specified namespaceURI and localName in this map.
NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML" and the language exposed through the Document does not support XML Namespaces (such as [HTML 4.01]).

cloneMap

public NamedNodeMapImpl cloneMap(NodeImpl ownerNode)
Cloning a NamedNodeMap is a DEEP OPERATION; it always clones all the nodes contained in the map.

Overrides:
cloneMap in class NamedNodeMapImpl