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 DomNamedNodeMap

    java.lang.Object
      |
      +--gnu.xml.dom.DomNamedNodeMap

All Implemented Interfaces:
  NamedNodeMap

public class DomNamedNodeMap
extends java.lang.Object
implements NamedNodeMap

"NamedNodeMap" implementation.

Used mostly to hold element attributes, but sometimes also to list notations or entities.

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

Constructor Summary
`DomNamedNodeMap(Document owner)` Constructs an empty map associated with the specified document.

Method Summary
`void` | `compact()` Reduces space utilization for this object.
`int` | `getLength()` DOM L1 Returns the length of the map.
`Node` | `getNamedItem(java.lang.String name)` DOM L1 Returns the named item from the map, or null; names are just the nodeName property.
`Node` | `getNamedItemNS(java.lang.String namespaceURI, java.lang.String localName)` DOM L2 Returns the named item from the map, or null; names are the localName and namespaceURI properties, ignoring any prefix.
`boolean` | `isReadonly()` Exposes the internal "readonly" flag.
`Node` | `item(int index)` DOM L1 Returns the indexed item from the map, or null.
`void` | `makeReadonly()` Sets the internal "readonly" flag so the node and its children can't be changed.
`Node` | `removeNamedItem(java.lang.String name)` DOM L1 Removes the named item from the map, or reports an exception; names are just the nodeName property.
`Node` | `removeNamedItemNS(java.lang.String namespaceURI, java.lang.String localName)` DOM L2 Removes the named item from the map, or reports an exception; names are the localName and namespaceURI properties.
`Node` | `setNamedItem(Node arg)` DOM L1 Stores the named item into the map, optionally overwriting any existing node with that name.
`Node` | `setNamedItemNS(Node arg)` DOM L2 Stores the named item into the map, optionally overwriting any existing node with that fully qualified name.

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

Constructor Detail

### DomNamedNodeMap

    public DomNamedNodeMap(Document owner)

  Constructs an empty map associated with the specified document.

Method Detail

### compact

    public void compact()

  Reduces space utilization for this object.

### isReadonly

    public final boolean isReadonly()

  Exposes the internal "readonly" flag. In DOM, all NamedNodeMap objects found in a DocumentType object are read-only (after they are fully constructed), and those holding attributes of a readonly element will also be readonly.

### makeReadonly

    public void makeReadonly()

  Sets the internal "readonly" flag so the node and its children can't be changed.

### getNamedItem

    public Node getNamedItem(java.lang.String name)

  DOM L1 Returns the named item from the map, or null; names are just the nodeName property.
  Specified by:
    `getNamedItem` in interface `NamedNodeMap`
  Following copied from interface: `org.w3c.dom.NamedNodeMap`
  Parameters:
    `name` - The `nodeName` of a node to retrieve.
  Returns:
    A `Node` (of any type) with the specified `nodeName`, or `null` if it does not identify any node in this map.

### getNamedItemNS

    public Node getNamedItemNS(java.lang.String namespaceURI,
                               java.lang.String localName)

  DOM L2 Returns the named item from the map, or null; names are the localName and namespaceURI properties, ignoring any prefix.
  Specified by:
    `getNamedItemNS` in interface `NamedNodeMap`
  Following copied from interface: `org.w3c.dom.NamedNodeMap`
  Parameters:
    `namespaceURI` - The namespace URI of the node to retrieve.
    `localName` - The local name of the node to retrieve.
  Returns:
    A `Node` (of any type) with the specified local name and namespace URI, or `null` if they do not identify any node in this map.

### setNamedItem

    public Node setNamedItem(Node arg)

  DOM L1 Stores the named item into the map, optionally overwriting any existing node with that name. The name used is just the nodeName attribute.
  Specified by:
    `setNamedItem` in interface `NamedNodeMap`
  Following copied from interface: `org.w3c.dom.NamedNodeMap`
  Parameters:
    `arg` - A node to store in this map. The node will later be accessible using the value of its `nodeName` attribute.
  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.

### setNamedItemNS

    public Node setNamedItemNS(Node arg)

  DOM L2 Stores the named item into the map, optionally overwriting any existing node with that fully qualified name. The name used incorporates the localName and namespaceURI properties, and ignores any prefix.
  Specified by:
    `setNamedItemNS` in interface `NamedNodeMap`
  Following copied from interface: `org.w3c.dom.NamedNodeMap`
  Parameters:
    `arg` - A node to store in this map. The node will later be accessible using the value of its `namespaceURI` and `localName` attributes.
  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: Always thrown if the current document does not support the `"XML"` feature, since namespaces were defined by XML.

### removeNamedItem

    public Node removeNamedItem(java.lang.String name)

  DOM L1 Removes the named item from the map, or reports an exception; names are just the nodeName property.
  Specified by:
    `removeNamedItem` in interface `NamedNodeMap`
  Following copied from interface: `org.w3c.dom.NamedNodeMap`
  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 localName)

  DOM L2 Removes the named item from the map, or reports an exception; names are the localName and namespaceURI properties.
  Specified by:
    `removeNamedItemNS` in interface `NamedNodeMap`
  Following copied from interface: `org.w3c.dom.NamedNodeMap`
  Parameters:
    `namespaceURI` - The namespace URI of the node to remove.
    `localName` - The local name of the node to remove.
  Returns:
    The node removed from this map if a node with such a local name and namespace URI exists.
  Throws:
    `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.

### item

    public Node item(int index)

  DOM L1 Returns the indexed item from the map, or null.
  Specified by:
    `item` in interface `NamedNodeMap`
  Following copied from interface: `org.w3c.dom.NamedNodeMap`
  Parameters:
    `index` - Index into this map.
  Returns:
    The node at the `index`th position in the map, or `null` if that is not a valid index.

### getLength

    public int getLength()

  DOM L1 Returns the length of the map.
  Specified by:
    `getLength` in interface `NamedNodeMap`

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.