Qt Toolkit - QDomNamedNodeMap Class

| Classes - Annotated - Tree - Functions - Home - Structure

# QDomNamedNodeMap Class Reference
[ XML module ]

The QDomNamedNodeMap class contains a collection of nodes that can be accessed by name. More...

`#include <qdom.h>`

List of all member functions.

## Public Members

- QDomNamedNodeMap ()
- QDomNamedNodeMap ( const QDomNamedNodeMap & )
- QDomNamedNodeMap& operator= ( const QDomNamedNodeMap & )
- bool operator== ( const QDomNamedNodeMap & ) const
- bool operator!= ( const QDomNamedNodeMap & ) const
- ~QDomNamedNodeMap ()
- QDomNode namedItem ( const QString & name ) const
- QDomNode setNamedItem ( const QDomNode & arg )
- QDomNode removeNamedItem ( const QString & name )
- QDomNode item ( int index ) const
- uint length () const
- bool contains ( const QString & name ) const

## Detailed Description

The QDomNamedNodeMap class contains a collection of nodes that can be accessed by name.

Note that QDomNamedNodeMap does not inherit from QDomNodeList; QDomNamedNodeMaps does not provide any specific order of the nodes. Nodes contained in a QDomNamedNodeMap may also be accessed by an ordinal index, but this is simply to allow a convenient enumeration of the contents of a QDomNamedNodeMap and does not imply that the DOM specifies an order on the nodes.

The QDomNamedNodeMap is used in three places:

- QDomDocumentType::entities() returns a map of all entities described in the DTD.
- QDomDocumentType::notations() returns a map of all notations described in the DTD.
- QDomElement::attributes() returns a map of all attributes of the element.

Items in the map are identified by the name which QDomNode::name() returns. They can be queried using the namedItem() function and set using setNamedItem().

See also namedItem() and setNamedItem().

## Member Function Documentation

### QDomNamedNodeMap::QDomNamedNodeMap ()

Constructs an empty map.

### QDomNamedNodeMap::QDomNamedNodeMap ( const QDomNamedNodeMap & n )

Copy constructor.

### QDomNamedNodeMap::~QDomNamedNodeMap ()

Destructor.

### bool QDomNamedNodeMap::contains ( const QString & name ) const

Returns TRUE if the map contains a node with the name name, otherwise FALSE.

### QDomNode QDomNamedNodeMap::item ( int index ) const

Retrieves the node at position index.

This can be used to iterate over the map.

See also length().

### uint QDomNamedNodeMap::length () const

Returns the number of nodes in the map.

See also item().

### QDomNode QDomNamedNodeMap::namedItem ( const QString & name ) const

Returns the node associated with they key name.

If the map does not contain such a node, then a null node is returned.

See also setNamedItem().

### bool QDomNamedNodeMap::operator!= ( const QDomNamedNodeMap & n ) const

Returns TRUE if the maps are not equal, FALSE otherwise.

### QDomNamedNodeMap& QDomNamedNodeMap::operator= ( const QDomNamedNodeMap & n )

Assignement operator.

### bool QDomNamedNodeMap::operator== ( const QDomNamedNodeMap & n ) const

Returns TRUE if the maps are equal, FALSE otherwise.

### QDomNode QDomNamedNodeMap::removeNamedItem ( const QString & name )

Removes the node with the name name from the map.

The function returns the removed node or a null node if the map did not contain a node with the name name.

See also setNamedItem().

### QDomNode QDomNamedNodeMap::setNamedItem ( const QDomNode & newNode )

Inserts the node newNode in the map. The kye for the map is the name of newNode as returned by QDomNode::nodeName().

The function returns the newly inserted node.

See also removeNamedItem().

Search the documentation, FAQ, qt-interest archive and more (uses www.trolltech.com):

This file is part of the Qt toolkit, copyright © 1995-2001 Trolltech, all rights reserved.