\section{DOM::Named\-Node\-Map Class Reference}
\label{classDOM_1_1NamedNodeMap}\index{DOM::NamedNodeMap@{DOM::NamedNodeMap}}
Objects implementing the {\tt  {\bf Named\-Node\-Map}{\rm (p.\,\pageref{classDOM_1_1NamedNodeMap})} } interface are used to represent collections of nodes that can be accessed by name.  


{\tt \#include $<$dom\_\-node.h$>$}

\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf Named\-Node\-Map} (const  {\bf Named\-Node\-Map} \&other)\label{classDOM_1_1NamedNodeMap_a1}

\item 
{\bf Named\-Node\-Map} \& {\bf operator=} (const  {\bf Named\-Node\-Map} \&other)\label{classDOM_1_1NamedNodeMap_a2}

\item 
unsigned long {\bf length} () const 
\begin{CompactList}\small\item\em The number of nodes in the map. \item\end{CompactList}\item 
{\bf Node} {\bf get\-Named\-Item} (const  {\bf DOMString} \&name) const 
\begin{CompactList}\small\item\em Retrieves a node specified by name. \item\end{CompactList}\item 
{\bf Node} {\bf set\-Named\-Item} (const  {\bf Node} \&arg)
\begin{CompactList}\small\item\em Adds a node using its {\tt  node\-Name } attribute. \item\end{CompactList}\item 
{\bf Node} {\bf remove\-Named\-Item} (const  {\bf DOMString} \&name)
\begin{CompactList}\small\item\em Removes a node specified by name. \item\end{CompactList}\item 
{\bf Node} {\bf item} (unsigned long index) const 
\begin{CompactList}\small\item\em Returns the {\tt  index } th item in the map. \item\end{CompactList}\item 
{\bf Node} {\bf get\-Named\-Item\-NS} (const  {\bf DOMString} \&namespace\-URI, const  {\bf DOMString} \&local\-Name) const 
\begin{CompactList}\small\item\em Introduced in {\bf DOM}{\rm (p.\,\pageref{namespaceDOM})} Level 2. \item\end{CompactList}\item 
{\bf Node} {\bf set\-Named\-Item\-NS} (const  {\bf Node} \&arg)
\begin{CompactList}\small\item\em Introduced in {\bf DOM}{\rm (p.\,\pageref{namespaceDOM})} Level 2. \item\end{CompactList}\item 
{\bf Node} {\bf remove\-Named\-Item\-NS} (const  {\bf DOMString} \&namespace\-URI, const  {\bf DOMString} \&local\-Name)
\begin{CompactList}\small\item\em Introduced in {\bf DOM}{\rm (p.\,\pageref{namespaceDOM})} Level 2. \item\end{CompactList}\item 
Named\-Node\-Map\-Impl $\ast$ {\bf handle} () const   throw ()\label{classDOM_1_1NamedNodeMap_a12}

\item 
bool {\bf is\-Null} () const   throw ()\label{classDOM_1_1NamedNodeMap_a13}

\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
{\bf Named\-Node\-Map} (Named\-Node\-Map\-Impl $\ast$i)\label{classDOM_1_1NamedNodeMap_b0}

\end{CompactItemize}
\subsection*{Protected Attributes}
\begin{CompactItemize}
\item 
Named\-Node\-Map\-Impl $\ast$ {\bf impl}\label{classDOM_1_1NamedNodeMap_p0}

\end{CompactItemize}
\subsection*{Friends}
\begin{CompactItemize}
\item 
class {\bf Node}\label{classDOM_1_1NamedNodeMap_n0}

\item 
class {\bf Document\-Type}\label{classDOM_1_1NamedNodeMap_n1}

\item 
class {\bf Node\-Impl}\label{classDOM_1_1NamedNodeMap_n2}

\end{CompactItemize}


\subsection{Detailed Description}
Objects implementing the {\tt  {\bf Named\-Node\-Map}{\rm (p.\,\pageref{classDOM_1_1NamedNodeMap})} } interface are used to represent collections of nodes that can be accessed by name. 

Note that {\tt  {\bf Named\-Node\-Map}{\rm (p.\,\pageref{classDOM_1_1NamedNodeMap})} } does not inherit from {\tt  {\bf Node\-List}{\rm (p.\,\pageref{classDOM_1_1NodeList})} } ; {\tt  {\bf Named\-Node\-Map}{\rm (p.\,\pageref{classDOM_1_1NamedNodeMap})} } s are not maintained in any particular order. Objects contained in an object implementing {\tt  {\bf Named\-Node\-Map}{\rm (p.\,\pageref{classDOM_1_1NamedNodeMap})} } may also be accessed by an ordinal index, but this is simply to allow convenient enumeration of the contents of a {\tt  {\bf Named\-Node\-Map}{\rm (p.\,\pageref{classDOM_1_1NamedNodeMap})} } , and does not imply that the {\bf DOM}{\rm (p.\,\pageref{namespaceDOM})} specifies an order to these Nodes. 



Definition at line 61 of file dom\_\-node.h.

\subsection{Member Function Documentation}
\index{DOM::NamedNodeMap@{DOM::Named\-Node\-Map}!length@{length}}
\index{length@{length}!DOM::NamedNodeMap@{DOM::Named\-Node\-Map}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned long Named\-Node\-Map::length () const}\label{classDOM_1_1NamedNodeMap_a4}


The number of nodes in the map. 

The range of valid child node indices is 0 to {\tt  length-1 } inclusive. 

Definition at line 119 of file dom\_\-node.cpp.\index{DOM::NamedNodeMap@{DOM::Named\-Node\-Map}!getNamedItem@{getNamedItem}}
\index{getNamedItem@{getNamedItem}!DOM::NamedNodeMap@{DOM::Named\-Node\-Map}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Node} Named\-Node\-Map::get\-Named\-Item (const {\bf DOMString} \& {\em name}) const}\label{classDOM_1_1NamedNodeMap_a5}


Retrieves a node specified by name. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em name}]Name of a node to retrieve.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A {\tt  {\bf Node}{\rm (p.\,\pageref{classDOM_1_1Node})} } (of any type) with the specified name, or {\tt  null } if the specified name did not identify any node in the map. \end{Desc}


Definition at line 67 of file dom\_\-node.cpp.

References get\-Named\-Item\-NS(), and KStd\-Accel::name().\index{DOM::NamedNodeMap@{DOM::Named\-Node\-Map}!setNamedItem@{setNamedItem}}
\index{setNamedItem@{setNamedItem}!DOM::NamedNodeMap@{DOM::Named\-Node\-Map}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Node} Named\-Node\-Map::set\-Named\-Item (const {\bf Node} \& {\em arg})}\label{classDOM_1_1NamedNodeMap_a6}


Adds a node using its {\tt  node\-Name } attribute. 

As the {\tt  node\-Name } attribute is used to derive the name which the node must be stored under, multiple nodes of certain types (those that have a \char`\"{}special\char`\"{} string value) cannot be stored as the names would clash. This is seen as preferable to allowing nodes to be aliased.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em arg}]A node to store in a named node map. The node will later be accessible using the value of the {\tt  node\-Name } attribute of the node. If a node with that name is already present in the map, it is replaced by the new one.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]If the new {\tt  {\bf Node}{\rm (p.\,\pageref{classDOM_1_1Node})} } replaces an existing node with the same name the previously existing {\tt  {\bf Node}{\rm (p.\,\pageref{classDOM_1_1Node})} } is returned, otherwise {\tt  null } is returned.\end{Desc}
\begin{Desc}
\item[Exceptions:]
\begin{description}
\item[{\em DOMException}]WRONG\_\-DOCUMENT\_\-ERR: Raised if {\tt  arg } was created from a different document than the one that created the {\tt  {\bf Named\-Node\-Map}{\rm (p.\,\pageref{classDOM_1_1NamedNodeMap})} } .\end{description}
\end{Desc}
NO\_\-MODIFICATION\_\-ALLOWED\_\-ERR: Raised if this {\tt  {\bf Named\-Node\-Map}{\rm (p.\,\pageref{classDOM_1_1NamedNodeMap})} } is readonly.

INUSE\_\-ATTRIBUTE\_\-ERR: Raised if {\tt  arg } is an {\tt  {\bf Attr}{\rm (p.\,\pageref{classDOM_1_1Attr})} } that is already an attribute of another {\tt  {\bf Element}{\rm (p.\,\pageref{classDOM_1_1Element})} } object. The {\bf DOM}{\rm (p.\,\pageref{namespaceDOM})} user must explicitly clone {\tt  {\bf Attr}{\rm (p.\,\pageref{classDOM_1_1Attr})} } nodes to re-use them in other elements. 

Definition at line 72 of file dom\_\-node.cpp.

References set\-Named\-Item\-NS().\index{DOM::NamedNodeMap@{DOM::Named\-Node\-Map}!removeNamedItem@{removeNamedItem}}
\index{removeNamedItem@{removeNamedItem}!DOM::NamedNodeMap@{DOM::Named\-Node\-Map}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Node} Named\-Node\-Map::remove\-Named\-Item (const {\bf DOMString} \& {\em name})}\label{classDOM_1_1NamedNodeMap_a7}


Removes a node specified by name. 

If the removed node is an {\tt  {\bf Attr}{\rm (p.\,\pageref{classDOM_1_1Attr})} } with a default value it is immediately replaced.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em name}]The name of a node to remove.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The node removed from the map or {\tt  null } if no node with such a name exists.\end{Desc}
\begin{Desc}
\item[Exceptions:]
\begin{description}
\item[{\em DOMException}]NOT\_\-FOUND\_\-ERR: Raised if there is no node named {\tt  name } in the map. \end{description}
\end{Desc}


Definition at line 77 of file dom\_\-node.cpp.

References KStd\-Accel::name(), and remove\-Named\-Item\-NS().\index{DOM::NamedNodeMap@{DOM::Named\-Node\-Map}!item@{item}}
\index{item@{item}!DOM::NamedNodeMap@{DOM::Named\-Node\-Map}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Node} Named\-Node\-Map::item (unsigned long {\em index}) const}\label{classDOM_1_1NamedNodeMap_a8}


Returns the {\tt  index } th item in the map. 

If {\tt  index } is greater than or equal to the number of nodes in the map, this returns {\tt  null } .

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em index}]Index into the map.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The node at the {\tt  index } th position in the {\tt  {\bf Named\-Node\-Map}{\rm (p.\,\pageref{classDOM_1_1NamedNodeMap})} } , or {\tt  null } if that is not a valid index. \end{Desc}


Definition at line 82 of file dom\_\-node.cpp.\index{DOM::NamedNodeMap@{DOM::Named\-Node\-Map}!getNamedItemNS@{getNamedItemNS}}
\index{getNamedItemNS@{getNamedItemNS}!DOM::NamedNodeMap@{DOM::Named\-Node\-Map}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Node} Named\-Node\-Map::get\-Named\-Item\-NS (const {\bf DOMString} \& {\em namespace\-URI}, const {\bf DOMString} \& {\em local\-Name}) const}\label{classDOM_1_1NamedNodeMap_a9}


Introduced in {\bf DOM}{\rm (p.\,\pageref{namespaceDOM})} Level 2. 

Retrieves a node specified by local name and namespace URI. HTML-only {\bf DOM}{\rm (p.\,\pageref{namespaceDOM})} implementations do not need to implement this method.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em namespace\-URI}]The namespace URI of the node to retrieve.\item[{\em local\-Name}]The local name of the node to retrieve.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A {\bf Node}{\rm (p.\,\pageref{classDOM_1_1Node})} (of any type) with the specified local name and namespace URI, or null if they do not identify any node in this map. \end{Desc}


Definition at line 88 of file dom\_\-node.cpp.

Referenced by get\-Named\-Item().\index{DOM::NamedNodeMap@{DOM::Named\-Node\-Map}!setNamedItemNS@{setNamedItemNS}}
\index{setNamedItemNS@{setNamedItemNS}!DOM::NamedNodeMap@{DOM::Named\-Node\-Map}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Node} Named\-Node\-Map::set\-Named\-Item\-NS (const {\bf Node} \& {\em arg})}\label{classDOM_1_1NamedNodeMap_a10}


Introduced in {\bf DOM}{\rm (p.\,\pageref{namespaceDOM})} Level 2. 

Adds a node using its namespace\-URI and local\-Name. If a node with that namespace URI and that local name is already present in this map, it is replaced by the new one. HTML-only {\bf DOM}{\rm (p.\,\pageref{namespaceDOM})} implementations do not need to implement this method.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em arg}]A node to store in this map. The node will later be accessible using the value of its namespace\-URI and local\-Name attributes.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]If the new {\bf Node}{\rm (p.\,\pageref{classDOM_1_1Node})} replaces an existing node the replaced {\bf Node}{\rm (p.\,\pageref{classDOM_1_1Node})} is returned, otherwise null is returned.\end{Desc}
\begin{Desc}
\item[Exceptions:]
\begin{description}
\item[{\em DOMException}]WRONG\_\-DOCUMENT\_\-ERR: Raised if arg was created from a different document than the one that created this map.\end{description}
\end{Desc}
NO\_\-MODIFICATION\_\-ALLOWED\_\-ERR: Raised if this map is readonly.

INUSE\_\-ATTRIBUTE\_\-ERR: Raised if arg is an {\bf Attr}{\rm (p.\,\pageref{classDOM_1_1Attr})} that is already an attribute of another {\bf Element}{\rm (p.\,\pageref{classDOM_1_1Element})} object. The {\bf DOM}{\rm (p.\,\pageref{namespaceDOM})} user must explicitly clone {\bf Attr}{\rm (p.\,\pageref{classDOM_1_1Attr})} nodes to re-use them in other elements. 

Definition at line 94 of file dom\_\-node.cpp.

References DOM::Node::impl.

Referenced by set\-Named\-Item().\index{DOM::NamedNodeMap@{DOM::Named\-Node\-Map}!removeNamedItemNS@{removeNamedItemNS}}
\index{removeNamedItemNS@{removeNamedItemNS}!DOM::NamedNodeMap@{DOM::Named\-Node\-Map}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Node} Named\-Node\-Map::remove\-Named\-Item\-NS (const {\bf DOMString} \& {\em namespace\-URI}, const {\bf DOMString} \& {\em local\-Name})}\label{classDOM_1_1NamedNodeMap_a11}


Introduced in {\bf DOM}{\rm (p.\,\pageref{namespaceDOM})} Level 2. 

Removes a node specified by local name and namespace URI. A removed attribute may be known to have a default value when this map contains the attributes attached to an element, as returned by the attributes attribute of the {\bf Node}{\rm (p.\,\pageref{classDOM_1_1Node})} interface. If so, an attribute immediately appears containing the default value as well as the corresponding namespace URI, local name, and prefix when applicable. HTML-only {\bf DOM}{\rm (p.\,\pageref{namespaceDOM})} implementations do not need to implement this method.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em namespace\-URI}]The namespace URI of the node to remove.\item[{\em local\-Name}]The local name of the node to remove.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The node removed from this map if a node with such a local name and namespace URI exists.\end{Desc}
\begin{Desc}
\item[Exceptions:]
\begin{description}
\item[{\em DOMException}]NOT\_\-FOUND\_\-ERR: Raised if there is no node with the specified namespace\-URI and local\-Name in this map.\end{description}
\end{Desc}
NO\_\-MODIFICATION\_\-ALLOWED\_\-ERR: Raised if this map is readonly. 

Definition at line 104 of file dom\_\-node.cpp.

Referenced by remove\-Named\-Item().

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
dom\_\-node.h\item 
dom\_\-node.cpp\end{CompactItemize}
