class DOM_NamedNodeMap

NamedNodeMaps are used to represent collections of nodes that can be accessed by name

Inheritance:


Public


@Comparisons
Constructors and assignment operator
DOM_NamedNodeMap ()
Default constructor for DOM_NamedNodeMap
DOM_NamedNodeMap (const DOM_NamedNodeMap &other)
Copy constructor
DOM_NamedNodeMap& operator = (const DOM_NamedNodeMap &other)
Assignment operator
Destructor.
~DOM_NamedNodeMap ()
Destructor for DOM_NamedNodeMap
Functions to change the node collection.
DOM_Node removeNamedItem (const DOMString &name)
Removes a node specified by name
Get functions.
DOM_Node getNamedItem (const DOMString &name)
Retrieves a node specified by name
int getLength ()
The number of nodes in the map
Set functions.
DOM_Node setNamedItem (DOM_Node arg)
Adds a node using its nodeName
DOM_Node item (int index)
Returns the indexth item in the map

Documentation

NamedNodeMaps are used to represent collections of nodes that can be accessed by name. Note that NamedNodeMap does not inherit from NodeList; NamedNodeMaps are not maintained in any particular order. Nodes contained in a NamedNodeMap may also be accessed by an ordinal index, but this is simply to allow convenient enumeration of the contents, and does not imply that the DOM specifies an order to these Nodes.
Constructors and assignment operator

DOM_NamedNodeMap()
Default constructor for DOM_NamedNodeMap. The resulting object does not refer to an actual DOM_NamedNodeMap node; it will compare == to 0, and is similar to a null object reference variable in Java. NamedNopes are instantiated by these methods: DOM_Node::getAttributes, DOM_DocumentType::getEntities andDOM_DocumentType::getNotations

DOM_NamedNodeMap(const DOM_NamedNodeMap &other)
Copy constructor. Creates a new DOM_NamedNodeMap reference object that refers to the same underlying NamedNodeMap as the original.
Parameters:
other - The object to be copied.

DOM_NamedNodeMap& operator = (const DOM_NamedNodeMap &other)
Assignment operator.
Parameters:
other - The object to be copied.

Destructor.

~DOM_NamedNodeMap()
Destructor for DOM_NamedNodeMap. The object being destroyed is the reference object, not the underlying NamedNodeMap itself.

Like most other DOM types in this implementation, memory management of named node maps is automatic. Instances of DOM_NamedNodeMap function as references to an underlying heap based implementation object, and should never be explicitly new-ed or deleted in application code, but should appear only as local variables or function parameters.

@Comparisons

Set functions.

DOM_Node setNamedItem(DOM_Node arg)
Adds a node using its nodeName.
As the nodeName attribute is used to derive the name which the node must be stored under, multiple nodes of certain types (those that have a "special" string value) cannot be stored as the names would clash. This is seen as preferable to allowing nodes to be aliased.
Throws:
DOMException WRONG_DOCUMENT_ERR: Raised if arg was created from a different document than the one that created the NamedNodeMap.
NO_MODIFICATION_ALLOWED_ERR: Raised if this NamedNodeMap 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.
Returns:
If the new Node replaces an existing node with the same name the previously existing Node is returned, otherwise null is returned.
Parameters:
arg - A node to store in a named node map. The node will later be accessible using the value of the nodeName attribute of the node. If a node with that name is already present in the map, it is replaced by the new one.

DOM_Node item(int index)
Returns the indexth item in the map. If index is greater than or equal to the number of nodes in the map, this returns null.
Returns:
The node at the indexth position in the NamedNodeMap, or null if that is not a valid index.
Parameters:
index - Index into the map.

Get functions.

DOM_Node getNamedItem(const DOMString &name)
Retrieves a node specified by name.
Returns:
A Node (of any type) with the specified name, or null DOM_Node if the specified name did not identify any node in the map.
Parameters:
name - Name of a node to retrieve.

int getLength()
The number of nodes in the map. The range of valid child node indices is 0 to length-1 inclusive.

Functions to change the node collection.

DOM_Node removeNamedItem(const DOMString &name)
Removes a node specified by name. If the removed node is an Attr with a default value it is immediately replaced.
Throws:
DOMException NOT_FOUND_ERR: Raised if there is no node named name in the map.
Returns:
The node removed from the map or null if no node with such a name exists.
Parameters:
name - The name of a node to remove.


This class has no child classes.

alphabetic index hierarchy of classes


XML Parser for C++ 2.0
Copyright © IBM Corp, 1999
Center for Java Technology
10275 N. De Anza Blvd.
Cupertino CA 95014 USA
Email: xml4c@us.ibm.com

IBM Logo