mirror of https://github.com/leethomason/tinyxml2
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
199 lines
18 KiB
HTML
199 lines
18 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
|
<meta name="generator" content="Doxygen 1.10.0"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<title>TinyXML-2: tinyxml2::XMLHandle Class Reference</title>
|
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="jquery.js"></script>
|
|
<script type="text/javascript" src="dynsections.js"></script>
|
|
<script type="text/javascript" src="clipboard.js"></script>
|
|
<script type="text/javascript" src="cookie.js"></script>
|
|
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="search/searchdata.js"></script>
|
|
<script type="text/javascript" src="search/search.js"></script>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
|
</head>
|
|
<body>
|
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
|
<div id="titlearea">
|
|
<table cellspacing="0" cellpadding="0">
|
|
<tbody>
|
|
<tr id="projectrow">
|
|
<td id="projectalign">
|
|
<div id="projectname">TinyXML-2<span id="projectnumber"> 10.0.0</span>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.10.0 -->
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
|
var searchBox = new SearchBox("searchBox", "search/",'.html');
|
|
/* @license-end */
|
|
</script>
|
|
<script type="text/javascript" src="menudata.js"></script>
|
|
<script type="text/javascript" src="menu.js"></script>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
|
$(function() {
|
|
initMenu('',true,false,'search.php','Search');
|
|
$(function() { init_search(); });
|
|
});
|
|
/* @license-end */
|
|
</script>
|
|
<div id="main-nav"></div>
|
|
<!-- window showing the filter options -->
|
|
<div id="MSearchSelectWindow"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
|
</div>
|
|
|
|
<!-- iframe showing the search results (closed by default) -->
|
|
<div id="MSearchResultsWindow">
|
|
<div id="MSearchResults">
|
|
<div class="SRPage">
|
|
<div id="SRIndex">
|
|
<div id="SRResults"></div>
|
|
<div class="SRStatus" id="Loading">Loading...</div>
|
|
<div class="SRStatus" id="Searching">Searching...</div>
|
|
<div class="SRStatus" id="NoMatches">No Matches</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="nav-path" class="navpath">
|
|
<ul>
|
|
<li class="navelem"><b>tinyxml2</b></li><li class="navelem"><a class="el" href="classtinyxml2_1_1_x_m_l_handle.html">XMLHandle</a></li> </ul>
|
|
</div>
|
|
</div><!-- top -->
|
|
<div class="header">
|
|
<div class="summary">
|
|
<a href="#pub-methods">Public Member Functions</a> |
|
|
<a href="classtinyxml2_1_1_x_m_l_handle-members.html">List of all members</a> </div>
|
|
<div class="headertitle"><div class="title">tinyxml2::XMLHandle Class Reference</div></div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
|
|
<p><code>#include <<a class="el" href="tinyxml2_8h_source.html">tinyxml2.h</a>></code></p>
|
|
<table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-methods" name="pub-methods"></a>
|
|
Public Member Functions</h2></td></tr>
|
|
<tr class="memitem:a9c240a35c18f053509b4b97ddccd9793" id="r_a9c240a35c18f053509b4b97ddccd9793"><td class="memItemLeft" align="right" valign="top"><a id="a9c240a35c18f053509b4b97ddccd9793" name="a9c240a35c18f053509b4b97ddccd9793"></a>
|
|
 </td><td class="memItemRight" valign="bottom"><b>XMLHandle</b> (<a class="el" href="classtinyxml2_1_1_x_m_l_node.html">XMLNode</a> *node)</td></tr>
|
|
<tr class="memdesc:a9c240a35c18f053509b4b97ddccd9793"><td class="mdescLeft"> </td><td class="mdescRight">Create a handle from any node (at any depth of the tree.) This can be a null pointer. <br /></td></tr>
|
|
<tr class="separator:a9c240a35c18f053509b4b97ddccd9793"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:aa2edbc1c0d3e3e8259bd98de7f1cf500" id="r_aa2edbc1c0d3e3e8259bd98de7f1cf500"><td class="memItemLeft" align="right" valign="top"><a id="aa2edbc1c0d3e3e8259bd98de7f1cf500" name="aa2edbc1c0d3e3e8259bd98de7f1cf500"></a>
|
|
 </td><td class="memItemRight" valign="bottom"><b>XMLHandle</b> (<a class="el" href="classtinyxml2_1_1_x_m_l_node.html">XMLNode</a> &node)</td></tr>
|
|
<tr class="memdesc:aa2edbc1c0d3e3e8259bd98de7f1cf500"><td class="mdescLeft"> </td><td class="mdescRight">Create a handle from a node. <br /></td></tr>
|
|
<tr class="separator:aa2edbc1c0d3e3e8259bd98de7f1cf500"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:afd8e01e6018c07347b8e6d80272466aa" id="r_afd8e01e6018c07347b8e6d80272466aa"><td class="memItemLeft" align="right" valign="top"><a id="afd8e01e6018c07347b8e6d80272466aa" name="afd8e01e6018c07347b8e6d80272466aa"></a>
|
|
 </td><td class="memItemRight" valign="bottom"><b>XMLHandle</b> (const <a class="el" href="classtinyxml2_1_1_x_m_l_handle.html">XMLHandle</a> &ref)</td></tr>
|
|
<tr class="memdesc:afd8e01e6018c07347b8e6d80272466aa"><td class="mdescLeft"> </td><td class="mdescRight">Copy constructor. <br /></td></tr>
|
|
<tr class="separator:afd8e01e6018c07347b8e6d80272466aa"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:aa07c9a53f78d7b2dc1018668641521d8" id="r_aa07c9a53f78d7b2dc1018668641521d8"><td class="memItemLeft" align="right" valign="top"><a id="aa07c9a53f78d7b2dc1018668641521d8" name="aa07c9a53f78d7b2dc1018668641521d8"></a>
|
|
<a class="el" href="classtinyxml2_1_1_x_m_l_handle.html">XMLHandle</a> & </td><td class="memItemRight" valign="bottom"><b>operator=</b> (const <a class="el" href="classtinyxml2_1_1_x_m_l_handle.html">XMLHandle</a> &ref)</td></tr>
|
|
<tr class="memdesc:aa07c9a53f78d7b2dc1018668641521d8"><td class="mdescLeft"> </td><td class="mdescRight">Assignment. <br /></td></tr>
|
|
<tr class="separator:aa07c9a53f78d7b2dc1018668641521d8"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a536447dc7f54c0cd11e031dad94795ae" id="r_a536447dc7f54c0cd11e031dad94795ae"><td class="memItemLeft" align="right" valign="top"><a id="a536447dc7f54c0cd11e031dad94795ae" name="a536447dc7f54c0cd11e031dad94795ae"></a>
|
|
<a class="el" href="classtinyxml2_1_1_x_m_l_handle.html">XMLHandle</a> </td><td class="memItemRight" valign="bottom"><b>FirstChild</b> ()</td></tr>
|
|
<tr class="memdesc:a536447dc7f54c0cd11e031dad94795ae"><td class="mdescLeft"> </td><td class="mdescRight">Get the first child of this handle. <br /></td></tr>
|
|
<tr class="separator:a536447dc7f54c0cd11e031dad94795ae"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a74b04dd0f15e0bf01860e282b840b6a3" id="r_a74b04dd0f15e0bf01860e282b840b6a3"><td class="memItemLeft" align="right" valign="top"><a id="a74b04dd0f15e0bf01860e282b840b6a3" name="a74b04dd0f15e0bf01860e282b840b6a3"></a>
|
|
<a class="el" href="classtinyxml2_1_1_x_m_l_handle.html">XMLHandle</a> </td><td class="memItemRight" valign="bottom"><b>FirstChildElement</b> (const char *name=0)</td></tr>
|
|
<tr class="memdesc:a74b04dd0f15e0bf01860e282b840b6a3"><td class="mdescLeft"> </td><td class="mdescRight">Get the first child element of this handle. <br /></td></tr>
|
|
<tr class="separator:a74b04dd0f15e0bf01860e282b840b6a3"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a9d09f04435f0f2f7d0816b0198d0517b" id="r_a9d09f04435f0f2f7d0816b0198d0517b"><td class="memItemLeft" align="right" valign="top"><a id="a9d09f04435f0f2f7d0816b0198d0517b" name="a9d09f04435f0f2f7d0816b0198d0517b"></a>
|
|
<a class="el" href="classtinyxml2_1_1_x_m_l_handle.html">XMLHandle</a> </td><td class="memItemRight" valign="bottom"><b>LastChild</b> ()</td></tr>
|
|
<tr class="memdesc:a9d09f04435f0f2f7d0816b0198d0517b"><td class="mdescLeft"> </td><td class="mdescRight">Get the last child of this handle. <br /></td></tr>
|
|
<tr class="separator:a9d09f04435f0f2f7d0816b0198d0517b"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a42cccd0ce8b1ce704f431025e9f19e0c" id="r_a42cccd0ce8b1ce704f431025e9f19e0c"><td class="memItemLeft" align="right" valign="top"><a id="a42cccd0ce8b1ce704f431025e9f19e0c" name="a42cccd0ce8b1ce704f431025e9f19e0c"></a>
|
|
<a class="el" href="classtinyxml2_1_1_x_m_l_handle.html">XMLHandle</a> </td><td class="memItemRight" valign="bottom"><b>LastChildElement</b> (const char *name=0)</td></tr>
|
|
<tr class="memdesc:a42cccd0ce8b1ce704f431025e9f19e0c"><td class="mdescLeft"> </td><td class="mdescRight">Get the last child element of this handle. <br /></td></tr>
|
|
<tr class="separator:a42cccd0ce8b1ce704f431025e9f19e0c"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a428374e756f4db4cbc287fec64eae02c" id="r_a428374e756f4db4cbc287fec64eae02c"><td class="memItemLeft" align="right" valign="top"><a id="a428374e756f4db4cbc287fec64eae02c" name="a428374e756f4db4cbc287fec64eae02c"></a>
|
|
<a class="el" href="classtinyxml2_1_1_x_m_l_handle.html">XMLHandle</a> </td><td class="memItemRight" valign="bottom"><b>PreviousSibling</b> ()</td></tr>
|
|
<tr class="memdesc:a428374e756f4db4cbc287fec64eae02c"><td class="mdescLeft"> </td><td class="mdescRight">Get the previous sibling of this handle. <br /></td></tr>
|
|
<tr class="separator:a428374e756f4db4cbc287fec64eae02c"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a786957e498039554ed334cdc36612a7e" id="r_a786957e498039554ed334cdc36612a7e"><td class="memItemLeft" align="right" valign="top"><a id="a786957e498039554ed334cdc36612a7e" name="a786957e498039554ed334cdc36612a7e"></a>
|
|
<a class="el" href="classtinyxml2_1_1_x_m_l_handle.html">XMLHandle</a> </td><td class="memItemRight" valign="bottom"><b>PreviousSiblingElement</b> (const char *name=0)</td></tr>
|
|
<tr class="memdesc:a786957e498039554ed334cdc36612a7e"><td class="mdescLeft"> </td><td class="mdescRight">Get the previous sibling element of this handle. <br /></td></tr>
|
|
<tr class="separator:a786957e498039554ed334cdc36612a7e"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:aad2eccc7c7c7b18145877c978c3850b5" id="r_aad2eccc7c7c7b18145877c978c3850b5"><td class="memItemLeft" align="right" valign="top"><a id="aad2eccc7c7c7b18145877c978c3850b5" name="aad2eccc7c7c7b18145877c978c3850b5"></a>
|
|
<a class="el" href="classtinyxml2_1_1_x_m_l_handle.html">XMLHandle</a> </td><td class="memItemRight" valign="bottom"><b>NextSibling</b> ()</td></tr>
|
|
<tr class="memdesc:aad2eccc7c7c7b18145877c978c3850b5"><td class="mdescLeft"> </td><td class="mdescRight">Get the next sibling of this handle. <br /></td></tr>
|
|
<tr class="separator:aad2eccc7c7c7b18145877c978c3850b5"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ae41d88ee061f3c49a081630ff753b2c5" id="r_ae41d88ee061f3c49a081630ff753b2c5"><td class="memItemLeft" align="right" valign="top"><a id="ae41d88ee061f3c49a081630ff753b2c5" name="ae41d88ee061f3c49a081630ff753b2c5"></a>
|
|
<a class="el" href="classtinyxml2_1_1_x_m_l_handle.html">XMLHandle</a> </td><td class="memItemRight" valign="bottom"><b>NextSiblingElement</b> (const char *name=0)</td></tr>
|
|
<tr class="memdesc:ae41d88ee061f3c49a081630ff753b2c5"><td class="mdescLeft"> </td><td class="mdescRight">Get the next sibling element of this handle. <br /></td></tr>
|
|
<tr class="separator:ae41d88ee061f3c49a081630ff753b2c5"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a689453c96dd3d4016437d2298d1de691" id="r_a689453c96dd3d4016437d2298d1de691"><td class="memItemLeft" align="right" valign="top"><a id="a689453c96dd3d4016437d2298d1de691" name="a689453c96dd3d4016437d2298d1de691"></a>
|
|
<a class="el" href="classtinyxml2_1_1_x_m_l_node.html">XMLNode</a> * </td><td class="memItemRight" valign="bottom"><b>ToNode</b> ()</td></tr>
|
|
<tr class="memdesc:a689453c96dd3d4016437d2298d1de691"><td class="mdescLeft"> </td><td class="mdescRight">Safe cast to <a class="el" href="classtinyxml2_1_1_x_m_l_node.html">XMLNode</a>. This can return null. <br /></td></tr>
|
|
<tr class="separator:a689453c96dd3d4016437d2298d1de691"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ab2371c4adb8b04afe04ed216bf9b0676" id="r_ab2371c4adb8b04afe04ed216bf9b0676"><td class="memItemLeft" align="right" valign="top"><a id="ab2371c4adb8b04afe04ed216bf9b0676" name="ab2371c4adb8b04afe04ed216bf9b0676"></a>
|
|
<a class="el" href="classtinyxml2_1_1_x_m_l_element.html">XMLElement</a> * </td><td class="memItemRight" valign="bottom"><b>ToElement</b> ()</td></tr>
|
|
<tr class="memdesc:ab2371c4adb8b04afe04ed216bf9b0676"><td class="mdescLeft"> </td><td class="mdescRight">Safe cast to <a class="el" href="classtinyxml2_1_1_x_m_l_element.html">XMLElement</a>. This can return null. <br /></td></tr>
|
|
<tr class="separator:ab2371c4adb8b04afe04ed216bf9b0676"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:accc80bcbd81e816f13a23c172587c288" id="r_accc80bcbd81e816f13a23c172587c288"><td class="memItemLeft" align="right" valign="top"><a id="accc80bcbd81e816f13a23c172587c288" name="accc80bcbd81e816f13a23c172587c288"></a>
|
|
<a class="el" href="classtinyxml2_1_1_x_m_l_text.html">XMLText</a> * </td><td class="memItemRight" valign="bottom"><b>ToText</b> ()</td></tr>
|
|
<tr class="memdesc:accc80bcbd81e816f13a23c172587c288"><td class="mdescLeft"> </td><td class="mdescRight">Safe cast to <a class="el" href="classtinyxml2_1_1_x_m_l_text.html">XMLText</a>. This can return null. <br /></td></tr>
|
|
<tr class="separator:accc80bcbd81e816f13a23c172587c288"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:add97784cbe14ef42bb36e158ad6e6082" id="r_add97784cbe14ef42bb36e158ad6e6082"><td class="memItemLeft" align="right" valign="top"><a id="add97784cbe14ef42bb36e158ad6e6082" name="add97784cbe14ef42bb36e158ad6e6082"></a>
|
|
<a class="el" href="classtinyxml2_1_1_x_m_l_unknown.html">XMLUnknown</a> * </td><td class="memItemRight" valign="bottom"><b>ToUnknown</b> ()</td></tr>
|
|
<tr class="memdesc:add97784cbe14ef42bb36e158ad6e6082"><td class="mdescLeft"> </td><td class="mdescRight">Safe cast to <a class="el" href="classtinyxml2_1_1_x_m_l_unknown.html">XMLUnknown</a>. This can return null. <br /></td></tr>
|
|
<tr class="separator:add97784cbe14ef42bb36e158ad6e6082"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a85d0c76920a013ea2a29456dbf7d160d" id="r_a85d0c76920a013ea2a29456dbf7d160d"><td class="memItemLeft" align="right" valign="top"><a id="a85d0c76920a013ea2a29456dbf7d160d" name="a85d0c76920a013ea2a29456dbf7d160d"></a>
|
|
<a class="el" href="classtinyxml2_1_1_x_m_l_declaration.html">XMLDeclaration</a> * </td><td class="memItemRight" valign="bottom"><b>ToDeclaration</b> ()</td></tr>
|
|
<tr class="memdesc:a85d0c76920a013ea2a29456dbf7d160d"><td class="mdescLeft"> </td><td class="mdescRight">Safe cast to <a class="el" href="classtinyxml2_1_1_x_m_l_declaration.html">XMLDeclaration</a>. This can return null. <br /></td></tr>
|
|
<tr class="separator:a85d0c76920a013ea2a29456dbf7d160d"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table>
|
|
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
|
<div class="textblock"><p>A <a class="el" href="classtinyxml2_1_1_x_m_l_handle.html">XMLHandle</a> is a class that wraps a node pointer with null checks; this is an incredibly useful thing. Note that <a class="el" href="classtinyxml2_1_1_x_m_l_handle.html">XMLHandle</a> is not part of the TinyXML-2 DOM structure. It is a separate utility class.</p>
|
|
<p>Take an example: </p><pre class="fragment"><Document>
|
|
<Element attributeA = "valueA">
|
|
<Child attributeB = "value1" />
|
|
<Child attributeB = "value2" />
|
|
</Element>
|
|
</Document>
|
|
</pre><p>Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very easy to write a <em>lot</em> of code that looks like:</p>
|
|
<pre class="fragment">XMLElement* root = document.FirstChildElement( "Document" );
|
|
if ( root )
|
|
{
|
|
XMLElement* element = root->FirstChildElement( "Element" );
|
|
if ( element )
|
|
{
|
|
XMLElement* child = element->FirstChildElement( "Child" );
|
|
if ( child )
|
|
{
|
|
XMLElement* child2 = child->NextSiblingElement( "Child" );
|
|
if ( child2 )
|
|
{
|
|
// Finally do something useful.
|
|
</pre><p>And that doesn't even cover "else" cases. <a class="el" href="classtinyxml2_1_1_x_m_l_handle.html">XMLHandle</a> addresses the verbosity of such code. A <a class="el" href="classtinyxml2_1_1_x_m_l_handle.html">XMLHandle</a> checks for null pointers so it is perfectly safe and correct to use:</p>
|
|
<pre class="fragment">XMLHandle docHandle( &document );
|
|
XMLElement* child2 = docHandle.FirstChildElement( "Document" ).FirstChildElement( "Element" ).FirstChildElement().NextSiblingElement();
|
|
if ( child2 )
|
|
{
|
|
// do something useful
|
|
</pre><p>Which is MUCH more concise and useful.</p>
|
|
<p>It is also safe to copy handles - internally they are nothing more than node pointers. </p><pre class="fragment">XMLHandle handleCopy = handle;
|
|
</pre><p>See also <a class="el" href="classtinyxml2_1_1_x_m_l_const_handle.html">XMLConstHandle</a>, which is the same as <a class="el" href="classtinyxml2_1_1_x_m_l_handle.html">XMLHandle</a>, but operates on const objects. </p>
|
|
</div><hr/>The documentation for this class was generated from the following file:<ul>
|
|
<li><a class="el" href="tinyxml2_8h_source.html">tinyxml2.h</a></li>
|
|
</ul>
|
|
</div><!-- contents -->
|
|
<!-- start footer part -->
|
|
<hr class="footer"/><address class="footer"><small>
|
|
Generated on Sat Dec 30 2023 18:02:35 for TinyXML-2 by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.10.0
|
|
</small></address>
|
|
</body>
|
|
</html>
|