<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qdom.cpp --> <title>QDomNamedNodeMap Class | Qt XML 5.9</title> <link rel="stylesheet" type="text/css" href="style/offline-simple.css" /> <script type="text/javascript"> document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css"); // loading style sheet breaks anchors that were jumped to before // so force jumping to anchor again setTimeout(function() { var anchor = location.hash; // need to jump to different anchor first (e.g. none) location.hash = "#"; setTimeout(function() { location.hash = anchor; }, 0); }, 0); </script> </head> <body> <div class="header" id="qtdocheader"> <div class="main"> <div class="main-rounded"> <div class="navigationbar"> <table><tr> <td >Qt 5.9</td><td ><a href="qtxml-index.html">Qt XML</a></td><td ><a href="qtxml-module.html">C++ Classes</a></td><td >QDomNamedNodeMap</td></tr></table><table class="buildversion"><tr> <td id="buildversion" width="100%" align="right">Qt 5.9.4 Reference Documentation</td> </tr></table> </div> </div> <div class="content"> <div class="line"> <div class="content mainContent"> <div class="sidebar"> <div class="toc"> <h3><a name="toc">Contents</a></h3> <ul> <li class="level1"><a href="#public-functions">Public Functions</a></li> <li class="level1"><a href="#details">Detailed Description</a></li> </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">QDomNamedNodeMap Class</h1> <!-- $$$QDomNamedNodeMap-brief --> <p>The <a href="qdomnamednodemap.html">QDomNamedNodeMap</a> class contains a collection of nodes that can be accessed by name. <a href="#details">More...</a></p> <!-- @@@QDomNamedNodeMap --> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QDomNamedNodeMap></span> </td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += xml</td></tr></table></div><ul> <li><a href="qdomnamednodemap-members.html">List of all members, including inherited members</a></li> </ul> <p><b>Note:</b> All functions in this class are reentrant.</p> <a name="public-functions"></a> <h2 id="public-functions">Public Functions</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qdomnamednodemap.html#QDomNamedNodeMap">QDomNamedNodeMap</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qdomnamednodemap.html#QDomNamedNodeMap-1">QDomNamedNodeMap</a></b>(const QDomNamedNodeMap &<i>n</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qdomnamednodemap.html#dtor.QDomNamedNodeMap">~QDomNamedNodeMap</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qdomnamednodemap.html#contains">contains</a></b>(const QString &<i>name</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qdomnamednodemap.html#count">count</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qdomnamednodemap.html#isEmpty">isEmpty</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QDomNode </td><td class="memItemRight bottomAlign"><b><a href="qdomnamednodemap.html#item">item</a></b>(int <i>index</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qdomnamednodemap.html#length">length</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QDomNode </td><td class="memItemRight bottomAlign"><b><a href="qdomnamednodemap.html#namedItem">namedItem</a></b>(const QString &<i>name</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QDomNode </td><td class="memItemRight bottomAlign"><b><a href="qdomnamednodemap.html#namedItemNS">namedItemNS</a></b>(const QString &<i>nsURI</i>, const QString &<i>localName</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QDomNode </td><td class="memItemRight bottomAlign"><b><a href="qdomnamednodemap.html#removeNamedItem">removeNamedItem</a></b>(const QString &<i>name</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QDomNode </td><td class="memItemRight bottomAlign"><b><a href="qdomnamednodemap.html#removeNamedItemNS">removeNamedItemNS</a></b>(const QString &<i>nsURI</i>, const QString &<i>localName</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QDomNode </td><td class="memItemRight bottomAlign"><b><a href="qdomnamednodemap.html#setNamedItem">setNamedItem</a></b>(const QDomNode &<i>newNode</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QDomNode </td><td class="memItemRight bottomAlign"><b><a href="qdomnamednodemap.html#setNamedItemNS">setNamedItemNS</a></b>(const QDomNode &<i>newNode</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qdomnamednodemap.html#size">size</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qdomnamednodemap.html#operator-not-eq">operator!=</a></b>(const QDomNamedNodeMap &<i>n</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QDomNamedNodeMap &</td><td class="memItemRight bottomAlign"><b><a href="qdomnamednodemap.html#operator-eq">operator=</a></b>(const QDomNamedNodeMap &<i>n</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qdomnamednodemap.html#operator-eq-eq">operator==</a></b>(const QDomNamedNodeMap &<i>n</i>) const</td></tr> </table></div> <a name="details"></a> <!-- $$$QDomNamedNodeMap-description --> <div class="descr"> <h2 id="details">Detailed Description</h2> <p>The <a href="qdomnamednodemap.html">QDomNamedNodeMap</a> class contains a collection of nodes that can be accessed by name.</p> <p>Note that <a href="qdomnamednodemap.html">QDomNamedNodeMap</a> does not inherit from <a href="qdomnodelist.html">QDomNodeList</a>. QDomNamedNodeMaps do not provide any specific node ordering. Although nodes in a <a href="qdomnamednodemap.html">QDomNamedNodeMap</a> may be accessed by an ordinal index, this is simply to allow a convenient enumeration of the contents of a <a href="qdomnamednodemap.html">QDomNamedNodeMap</a>, and does not imply that the DOM specifies an ordering of the nodes.</p> <p>The <a href="qdomnamednodemap.html">QDomNamedNodeMap</a> is used in three places:</p> <ol class="1" type="1"><li><a href="qdomdocumenttype.html#entities">QDomDocumentType::entities</a>() returns a map of all entities described in the DTD.</li> <li><a href="qdomdocumenttype.html#notations">QDomDocumentType::notations</a>() returns a map of all notations described in the DTD.</li> <li><a href="qdomnode.html#attributes">QDomNode::attributes</a>() returns a map of all attributes of an element.</li> </ol> <p>Items in the map are identified by the name which QDomNode::name() returns. Nodes are retrieved using <a href="qdomnamednodemap.html#namedItem">namedItem</a>(), <a href="qdomnamednodemap.html#namedItemNS">namedItemNS</a>() or <a href="qdomnamednodemap.html#item">item</a>(). New nodes are inserted with <a href="qdomnamednodemap.html#setNamedItem">setNamedItem</a>() or <a href="qdomnamednodemap.html#setNamedItemNS">setNamedItemNS</a>() and removed with <a href="qdomnamednodemap.html#removeNamedItem">removeNamedItem</a>() or <a href="qdomnamednodemap.html#removeNamedItemNS">removeNamedItemNS</a>(). Use <a href="qdomnamednodemap.html#contains">contains</a>() to see if an item with the given name is in the named node map. The number of items is returned by <a href="qdomnamednodemap.html#length">length</a>().</p> <p>Terminology: in this class we use "item" and "node" interchangeably.</p> </div> <!-- @@@QDomNamedNodeMap --> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$QDomNamedNodeMap[overload1]$$$QDomNamedNodeMap --> <h3 class="fn" id="QDomNamedNodeMap"><a name="QDomNamedNodeMap"></a>QDomNamedNodeMap::<span class="name">QDomNamedNodeMap</span>()</h3> <p>Constructs an empty named node map.</p> <!-- @@@QDomNamedNodeMap --> <!-- $$$QDomNamedNodeMap$$$QDomNamedNodeMapconstQDomNamedNodeMap& --> <h3 class="fn" id="QDomNamedNodeMap-1"><a name="QDomNamedNodeMap-1"></a>QDomNamedNodeMap::<span class="name">QDomNamedNodeMap</span>(const <span class="type"><a href="qdomnamednodemap.html#QDomNamedNodeMap">QDomNamedNodeMap</a></span> &<i>n</i>)</h3> <p>Constructs a copy of <i>n</i>.</p> <!-- @@@QDomNamedNodeMap --> <!-- $$$~QDomNamedNodeMap[overload1]$$$~QDomNamedNodeMap --> <h3 class="fn" id="dtor.QDomNamedNodeMap"><a name="dtor.QDomNamedNodeMap"></a>QDomNamedNodeMap::<span class="name">~QDomNamedNodeMap</span>()</h3> <p>Destroys the object and frees its resources.</p> <!-- @@@~QDomNamedNodeMap --> <!-- $$$contains[overload1]$$$containsconstQString& --> <h3 class="fn" id="contains"><a name="contains"></a><span class="type">bool</span> QDomNamedNodeMap::<span class="name">contains</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>name</i>) const</h3> <p>Returns <code>true</code> if the map contains a node called <i>name</i>; otherwise returns <code>false</code>.</p> <p><b>Note:</b> This function does not take the presence of namespaces into account. Use <a href="qdomnamednodemap.html#namedItemNS">namedItemNS</a>() to test whether the map contains a node with a specific namespace URI and name.</p> <!-- @@@contains --> <!-- $$$count[overload1]$$$count --> <h3 class="fn" id="count"><a name="count"></a><span class="type">int</span> QDomNamedNodeMap::<span class="name">count</span>() const</h3> <p>This function is provided for Qt API consistency. It is equivalent to <a href="qdomnamednodemap.html#length">length</a>().</p> <!-- @@@count --> <!-- $$$isEmpty[overload1]$$$isEmpty --> <h3 class="fn" id="isEmpty"><a name="isEmpty"></a><span class="type">bool</span> QDomNamedNodeMap::<span class="name">isEmpty</span>() const</h3> <p>Returns <code>true</code> if the map is empty; otherwise returns <code>false</code>. This function is provided for Qt API consistency.</p> <!-- @@@isEmpty --> <!-- $$$item[overload1]$$$itemint --> <h3 class="fn" id="item"><a name="item"></a><span class="type"><a href="qdomnode.html">QDomNode</a></span> QDomNamedNodeMap::<span class="name">item</span>(<span class="type">int</span> <i>index</i>) const</h3> <p>Retrieves the node at position <i>index</i>.</p> <p>This can be used to iterate over the map. Note that the nodes in the map are ordered arbitrarily.</p> <p><b>See also </b><a href="qdomnamednodemap.html#length">length</a>().</p> <!-- @@@item --> <!-- $$$length[overload1]$$$length --> <h3 class="fn" id="length"><a name="length"></a><span class="type">int</span> QDomNamedNodeMap::<span class="name">length</span>() const</h3> <p>Returns the number of nodes in the map.</p> <p><b>See also </b><a href="qdomnamednodemap.html#item">item</a>().</p> <!-- @@@length --> <!-- $$$namedItem[overload1]$$$namedItemconstQString& --> <h3 class="fn" id="namedItem"><a name="namedItem"></a><span class="type"><a href="qdomnode.html">QDomNode</a></span> QDomNamedNodeMap::<span class="name">namedItem</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>name</i>) const</h3> <p>Returns the node called <i>name</i>.</p> <p>If the named node map does not contain such a node, a <a href="qdomnode.html#isNull">null node</a> is returned. A node's name is the name returned by <a href="qdomnode.html#nodeName">QDomNode::nodeName</a>().</p> <p><b>See also </b><a href="qdomnamednodemap.html#setNamedItem">setNamedItem</a>() and <a href="qdomnamednodemap.html#namedItemNS">namedItemNS</a>().</p> <!-- @@@namedItem --> <!-- $$$namedItemNS[overload1]$$$namedItemNSconstQString&constQString& --> <h3 class="fn" id="namedItemNS"><a name="namedItemNS"></a><span class="type"><a href="qdomnode.html">QDomNode</a></span> QDomNamedNodeMap::<span class="name">namedItemNS</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>nsURI</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>localName</i>) const</h3> <p>Returns the node associated with the local name <i>localName</i> and the namespace URI <i>nsURI</i>.</p> <p>If the map does not contain such a node, a <a href="qdomnode.html#isNull">null node</a> is returned.</p> <p><b>See also </b><a href="qdomnamednodemap.html#setNamedItemNS">setNamedItemNS</a>() and <a href="qdomnamednodemap.html#namedItem">namedItem</a>().</p> <!-- @@@namedItemNS --> <!-- $$$removeNamedItem[overload1]$$$removeNamedItemconstQString& --> <h3 class="fn" id="removeNamedItem"><a name="removeNamedItem"></a><span class="type"><a href="qdomnode.html">QDomNode</a></span> QDomNamedNodeMap::<span class="name">removeNamedItem</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>name</i>)</h3> <p>Removes the node called <i>name</i> from the map.</p> <p>The function returns the removed node or a <a href="qdomnode.html#isNull">null node</a> if the map did not contain a node called <i>name</i>.</p> <p><b>See also </b><a href="qdomnamednodemap.html#setNamedItem">setNamedItem</a>(), <a href="qdomnamednodemap.html#namedItem">namedItem</a>(), and <a href="qdomnamednodemap.html#removeNamedItemNS">removeNamedItemNS</a>().</p> <!-- @@@removeNamedItem --> <!-- $$$removeNamedItemNS[overload1]$$$removeNamedItemNSconstQString&constQString& --> <h3 class="fn" id="removeNamedItemNS"><a name="removeNamedItemNS"></a><span class="type"><a href="qdomnode.html">QDomNode</a></span> QDomNamedNodeMap::<span class="name">removeNamedItemNS</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>nsURI</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>localName</i>)</h3> <p>Removes the node with the local name <i>localName</i> and the namespace URI <i>nsURI</i> from the map.</p> <p>The function returns the removed node or a <a href="qdomnode.html#isNull">null node</a> if the map did not contain a node with the local name <i>localName</i> and the namespace URI <i>nsURI</i>.</p> <p><b>See also </b><a href="qdomnamednodemap.html#setNamedItemNS">setNamedItemNS</a>(), <a href="qdomnamednodemap.html#namedItemNS">namedItemNS</a>(), and <a href="qdomnamednodemap.html#removeNamedItem">removeNamedItem</a>().</p> <!-- @@@removeNamedItemNS --> <!-- $$$setNamedItem[overload1]$$$setNamedItemconstQDomNode& --> <h3 class="fn" id="setNamedItem"><a name="setNamedItem"></a><span class="type"><a href="qdomnode.html">QDomNode</a></span> QDomNamedNodeMap::<span class="name">setNamedItem</span>(const <span class="type"><a href="qdomnode.html">QDomNode</a></span> &<i>newNode</i>)</h3> <p>Inserts the node <i>newNode</i> into the named node map. The name used by the map is the node name of <i>newNode</i> as returned by <a href="qdomnode.html#nodeName">QDomNode::nodeName</a>().</p> <p>If the new node replaces an existing node, i.e. the map contains a node with the same name, the replaced node is returned.</p> <p><b>See also </b><a href="qdomnamednodemap.html#namedItem">namedItem</a>(), <a href="qdomnamednodemap.html#removeNamedItem">removeNamedItem</a>(), and <a href="qdomnamednodemap.html#setNamedItemNS">setNamedItemNS</a>().</p> <!-- @@@setNamedItem --> <!-- $$$setNamedItemNS[overload1]$$$setNamedItemNSconstQDomNode& --> <h3 class="fn" id="setNamedItemNS"><a name="setNamedItemNS"></a><span class="type"><a href="qdomnode.html">QDomNode</a></span> QDomNamedNodeMap::<span class="name">setNamedItemNS</span>(const <span class="type"><a href="qdomnode.html">QDomNode</a></span> &<i>newNode</i>)</h3> <p>Inserts the node <i>newNode</i> in the map. If a node with the same namespace URI and the same local name already exists in the map, it is replaced by <i>newNode</i>. If the new node replaces an existing node, the replaced node is returned.</p> <p><b>See also </b><a href="qdomnamednodemap.html#namedItemNS">namedItemNS</a>(), <a href="qdomnamednodemap.html#removeNamedItemNS">removeNamedItemNS</a>(), and <a href="qdomnamednodemap.html#setNamedItem">setNamedItem</a>().</p> <!-- @@@setNamedItemNS --> <!-- $$$size[overload1]$$$size --> <h3 class="fn" id="size"><a name="size"></a><span class="type">int</span> QDomNamedNodeMap::<span class="name">size</span>() const</h3> <p>This function is provided for Qt API consistency. It is equivalent to <a href="qdomnamednodemap.html#length">length</a>().</p> <!-- @@@size --> <!-- $$$operator!=[overload1]$$$operator!=constQDomNamedNodeMap& --> <h3 class="fn" id="operator-not-eq"><a name="operator-not-eq"></a><span class="type">bool</span> QDomNamedNodeMap::<span class="name">operator!=</span>(const <span class="type"><a href="qdomnamednodemap.html#QDomNamedNodeMap">QDomNamedNodeMap</a></span> &<i>n</i>) const</h3> <p>Returns <code>true</code> if <i>n</i> and this named node map are not equal; otherwise returns <code>false</code>.</p> <!-- @@@operator!= --> <!-- $$$operator=[overload1]$$$operator=constQDomNamedNodeMap& --> <h3 class="fn" id="operator-eq"><a name="operator-eq"></a><span class="type"><a href="qdomnamednodemap.html#QDomNamedNodeMap">QDomNamedNodeMap</a></span> &QDomNamedNodeMap::<span class="name">operator=</span>(const <span class="type"><a href="qdomnamednodemap.html#QDomNamedNodeMap">QDomNamedNodeMap</a></span> &<i>n</i>)</h3> <p>Assigns <i>n</i> to this named node map.</p> <!-- @@@operator= --> <!-- $$$operator==[overload1]$$$operator==constQDomNamedNodeMap& --> <h3 class="fn" id="operator-eq-eq"><a name="operator-eq-eq"></a><span class="type">bool</span> QDomNamedNodeMap::<span class="name">operator==</span>(const <span class="type"><a href="qdomnamednodemap.html#QDomNamedNodeMap">QDomNamedNodeMap</a></span> &<i>n</i>) const</h3> <p>Returns <code>true</code> if <i>n</i> and this named node map are equal; otherwise returns <code>false</code>.</p> <!-- @@@operator== --> </div> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2017 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.<br> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.<br> Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners. </p> </div> </body> </html>