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

## org.apache.xerces.dom
Class AttributeMap

    java.lang.Object
      org.apache.xerces.dom.NamedNodeMapImpl
          org.apache.xerces.dom.AttributeMap

All Implemented Interfaces:
  java.io.Serializable, org.w3c.dom.NamedNodeMap

    public class AttributeMap

extends NamedNodeMapImpl

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

- managing ownership of attribute nodes
- managing default attributes
- firing mutation events

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

# INTERNAL:

  Usage of this class is not supported. It may be altered or removed at any time.

Field Summary

Fields inherited from class org.apache.xerces.dom.NamedNodeMapImpl
`CHANGED, flags, HASDEFAULTS, nodes, ownerNode, READONLY`

Constructor Summary
`protected` | `AttributeMap(ElementImpl ownerNode, NamedNodeMapImpl defaults)` Constructs a named node map.

Method Summary
`protected int` | `addItem(org.w3c.dom.Node arg)`
`protected void` | `cloneContent(NamedNodeMapImpl srcmap)` Override parent's method to set the ownerNode correctly
`NamedNodeMapImpl` | `cloneMap(NodeImpl ownerNode)` Cloning a NamedNodeMap is a DEEP OPERATION; it always clones all the nodes contained in the map.
`protected org.w3c.dom.Node` | `internalRemoveNamedItem(java.lang.String name, boolean raiseEx)` Internal removeNamedItem method allowing to specify whether an exception must be thrown if the specified name is not found.
`protected org.w3c.dom.Node` | `internalRemoveNamedItemNS(java.lang.String namespaceURI, java.lang.String name, boolean raiseEx)` Internal removeNamedItemNS method allowing to specify whether an exception must be thrown if the specified local name and namespace URI is not found.
`protected void` | `reconcileDefaults(NamedNodeMapImpl defaults)` Get this AttributeMap in sync with the given "defaults" map.
`protected org.w3c.dom.Node` | `removeItem(org.w3c.dom.Node item, boolean addDefault)` NON-DOM: Remove the node object NOTE: Specifically removes THIS NODE -- not the node with this name, nor the node with these contents.
`org.w3c.dom.Node` | `removeNamedItem(java.lang.String name)` Removes a node specified by name.
`org.w3c.dom.Node` | `removeNamedItemNS(java.lang.String namespaceURI, java.lang.String name)` Introduced in DOM Level 2.
`org.w3c.dom.Node` | `setNamedItem(org.w3c.dom.Node arg)` Adds an attribute using its nodeName attribute.
`org.w3c.dom.Node` | `setNamedItemNS(org.w3c.dom.Node arg)` Adds an attribute using its namespaceURI and localName.

Methods inherited from class org.apache.xerces.dom.NamedNodeMapImpl
`cloneMap, findNamePoint, findNamePoint, getItem, getLength, getNamedItem, getNamedItemIndex, getNamedItemNS, item, precedes, removeAll, removeItem, setOwnerDocument`

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

Constructor Detail

### AttributeMap

    protected AttributeMap(ElementImpl ownerNode,
                           NamedNodeMapImpl defaults)

  Constructs a named node map.

Method Detail

### setNamedItem

    public org.w3c.dom.Node setNamedItem(org.w3c.dom.Node arg)
                                  throws org.w3c.dom.DOMException

  Adds an attribute using its nodeName attribute.

  Specified by:
    `setNamedItem` in interface `org.w3c.dom.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:
    `org.w3c.dom.DOMException` - The exception description.
  See Also:
    `NamedNodeMap.setNamedItem(org.w3c.dom.Node)`

### setNamedItemNS

    public org.w3c.dom.Node setNamedItemNS(org.w3c.dom.Node arg)
                                    throws org.w3c.dom.DOMException

  Adds an attribute using its namespaceURI and localName.

  Specified by:
    `setNamedItemNS` in interface `org.w3c.dom.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:
    `org.w3c.dom.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 org.w3c.dom.Node removeNamedItem(java.lang.String name)
                                     throws org.w3c.dom.DOMException

  Description copied from interface: `org.w3c.dom.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 `org.w3c.dom.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:
    `org.w3c.dom.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.

### removeItem

    protected org.w3c.dom.Node removeItem(org.w3c.dom.Node item,
                                          boolean addDefault)
                                   throws org.w3c.dom.DOMException

  NON-DOM: Remove the node object NOTE: Specifically removes THIS NODE -- not the node with this name, nor the node with these contents. If node does not belong to this named node map, we throw a DOMException.

  Parameters:
    `item` - The node to remove
    `addDefault` - true -- magically add default attribute
  Returns:
    Removed node
  Throws:
    `org.w3c.dom.DOMException`

### internalRemoveNamedItem

    protected final org.w3c.dom.Node internalRemoveNamedItem(java.lang.String name,
                                                             boolean raiseEx)

  Internal removeNamedItem method allowing to specify whether an exception must be thrown if the specified name is not found.

### removeNamedItemNS

    public org.w3c.dom.Node removeNamedItemNS(java.lang.String namespaceURI,
                                              java.lang.String name)
                                       throws org.w3c.dom.DOMException

  Introduced in DOM Level 2.

  Removes an attribute specified by local name and namespace URI.

  Specified by:
    `removeNamedItemNS` in interface `org.w3c.dom.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.
    `org.w3c.dom.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]).

### internalRemoveNamedItemNS

    protected final org.w3c.dom.Node internalRemoveNamedItemNS(java.lang.String namespaceURI,
                                                               java.lang.String name,
                                                               boolean raiseEx)

  Internal removeNamedItemNS method allowing to specify whether an exception must be thrown if the specified local name and namespace URI is not found.

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

### cloneContent

    protected void cloneContent(NamedNodeMapImpl srcmap)

  Override parent's method to set the ownerNode correctly

  Overrides:
    `cloneContent` in class `NamedNodeMapImpl`

### reconcileDefaults

    protected void reconcileDefaults(NamedNodeMapImpl defaults)

  Get this AttributeMap in sync with the given "defaults" map.

  Parameters:
    `defaults` - The default attributes map to sync with.

### addItem

    protected final int addItem(org.w3c.dom.Node arg)

  Overrides:
    `addItem` in class `NamedNodeMapImpl`

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

Copyright © 1999-2006 The Apache Software Foundation. All Rights Reserved.