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.
tinyxml2/docs/classtinyxml2_1_1_x_m_l_pri...

401 lines
28 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::XMLPrinter 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">&#160;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&amp;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&amp;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_printer.html">XMLPrinter</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pro-methods">Protected Member Functions</a> &#124;
<a href="classtinyxml2_1_1_x_m_l_printer-members.html">List of all members</a> </div>
<div class="headertitle"><div class="title">tinyxml2::XMLPrinter Class Reference</div></div>
</div><!--header-->
<div class="contents">
<p><code>#include &lt;<a class="el" href="tinyxml2_8h_source.html">tinyxml2.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for tinyxml2::XMLPrinter:</div>
<div class="dyncontent">
<div class="center">
<img src="classtinyxml2_1_1_x_m_l_printer.png" usemap="#tinyxml2::XMLPrinter_map" alt=""/>
<map id="tinyxml2::XMLPrinter_map" name="tinyxml2::XMLPrinter_map">
<area href="classtinyxml2_1_1_x_m_l_visitor.html" alt="tinyxml2::XMLVisitor" shape="rect" coords="0,0,128,24"/>
</map>
</div></div>
<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:aa6d3841c069085f5b8a27bc7103c04f7" id="r_aa6d3841c069085f5b8a27bc7103c04f7"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#aa6d3841c069085f5b8a27bc7103c04f7">XMLPrinter</a> (FILE *file=0, bool compact=false, int depth=0)</td></tr>
<tr class="separator:aa6d3841c069085f5b8a27bc7103c04f7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a178c608ce8476043d5d6513819cde903" id="r_a178c608ce8476043d5d6513819cde903"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a178c608ce8476043d5d6513819cde903">PushHeader</a> (bool writeBOM, bool writeDeclaration)</td></tr>
<tr class="separator:a178c608ce8476043d5d6513819cde903"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a20fb06c83bd13e5140d7dd13af06c010" id="r_a20fb06c83bd13e5140d7dd13af06c010"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a20fb06c83bd13e5140d7dd13af06c010">OpenElement</a> (const char *name, bool compactMode=false)</td></tr>
<tr class="separator:a20fb06c83bd13e5140d7dd13af06c010"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9a4e2c9348b42e147629d5a99f4af3f0" id="r_a9a4e2c9348b42e147629d5a99f4af3f0"><td class="memItemLeft" align="right" valign="top"><a id="a9a4e2c9348b42e147629d5a99f4af3f0" name="a9a4e2c9348b42e147629d5a99f4af3f0"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>PushAttribute</b> (const char *name, const char *value)</td></tr>
<tr class="memdesc:a9a4e2c9348b42e147629d5a99f4af3f0"><td class="mdescLeft">&#160;</td><td class="mdescRight">If streaming, add an attribute to an open element. <br /></td></tr>
<tr class="separator:a9a4e2c9348b42e147629d5a99f4af3f0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad04d29562b46fcdb23ab320f8b664240" id="r_ad04d29562b46fcdb23ab320f8b664240"><td class="memItemLeft" align="right" valign="top"><a id="ad04d29562b46fcdb23ab320f8b664240" name="ad04d29562b46fcdb23ab320f8b664240"></a>
virtual void&#160;</td><td class="memItemRight" valign="bottom"><b>CloseElement</b> (bool compactMode=false)</td></tr>
<tr class="memdesc:ad04d29562b46fcdb23ab320f8b664240"><td class="mdescLeft">&#160;</td><td class="mdescRight">If streaming, close the Element. <br /></td></tr>
<tr class="separator:ad04d29562b46fcdb23ab320f8b664240"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1cc16a9362df4332012cb13cff6441b3" id="r_a1cc16a9362df4332012cb13cff6441b3"><td class="memItemLeft" align="right" valign="top"><a id="a1cc16a9362df4332012cb13cff6441b3" name="a1cc16a9362df4332012cb13cff6441b3"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>PushText</b> (const char *text, bool cdata=false)</td></tr>
<tr class="memdesc:a1cc16a9362df4332012cb13cff6441b3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Add a text node. <br /></td></tr>
<tr class="separator:a1cc16a9362df4332012cb13cff6441b3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3e0d4d78de25d4cf081009e1431cea7e" id="r_a3e0d4d78de25d4cf081009e1431cea7e"><td class="memItemLeft" align="right" valign="top"><a id="a3e0d4d78de25d4cf081009e1431cea7e" name="a3e0d4d78de25d4cf081009e1431cea7e"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>PushText</b> (int value)</td></tr>
<tr class="memdesc:a3e0d4d78de25d4cf081009e1431cea7e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Add a text node from an integer. <br /></td></tr>
<tr class="separator:a3e0d4d78de25d4cf081009e1431cea7e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a661fb50e7e0a4918d2d259cb0fae647e" id="r_a661fb50e7e0a4918d2d259cb0fae647e"><td class="memItemLeft" align="right" valign="top"><a id="a661fb50e7e0a4918d2d259cb0fae647e" name="a661fb50e7e0a4918d2d259cb0fae647e"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>PushText</b> (unsigned value)</td></tr>
<tr class="memdesc:a661fb50e7e0a4918d2d259cb0fae647e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Add a text node from an unsigned. <br /></td></tr>
<tr class="separator:a661fb50e7e0a4918d2d259cb0fae647e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a96b0a0bfe105154a0a6c37d725258f0a" id="r_a96b0a0bfe105154a0a6c37d725258f0a"><td class="memItemLeft" align="right" valign="top"><a id="a96b0a0bfe105154a0a6c37d725258f0a" name="a96b0a0bfe105154a0a6c37d725258f0a"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>PushText</b> (int64_t value)</td></tr>
<tr class="memdesc:a96b0a0bfe105154a0a6c37d725258f0a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Add a text node from a signed 64bit integer. <br /></td></tr>
<tr class="separator:a96b0a0bfe105154a0a6c37d725258f0a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a60b0a4cf57371ff8679c2c7556ccb708" id="r_a60b0a4cf57371ff8679c2c7556ccb708"><td class="memItemLeft" align="right" valign="top"><a id="a60b0a4cf57371ff8679c2c7556ccb708" name="a60b0a4cf57371ff8679c2c7556ccb708"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>PushText</b> (uint64_t value)</td></tr>
<tr class="memdesc:a60b0a4cf57371ff8679c2c7556ccb708"><td class="mdescLeft">&#160;</td><td class="mdescRight">Add a text node from an unsigned 64bit integer. <br /></td></tr>
<tr class="separator:a60b0a4cf57371ff8679c2c7556ccb708"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4390e5fa1ed05189a8686647345ab29f" id="r_a4390e5fa1ed05189a8686647345ab29f"><td class="memItemLeft" align="right" valign="top"><a id="a4390e5fa1ed05189a8686647345ab29f" name="a4390e5fa1ed05189a8686647345ab29f"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>PushText</b> (bool value)</td></tr>
<tr class="memdesc:a4390e5fa1ed05189a8686647345ab29f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Add a text node from a bool. <br /></td></tr>
<tr class="separator:a4390e5fa1ed05189a8686647345ab29f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1dbb1390e829d0673af66b9cd1928bd7" id="r_a1dbb1390e829d0673af66b9cd1928bd7"><td class="memItemLeft" align="right" valign="top"><a id="a1dbb1390e829d0673af66b9cd1928bd7" name="a1dbb1390e829d0673af66b9cd1928bd7"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>PushText</b> (float value)</td></tr>
<tr class="memdesc:a1dbb1390e829d0673af66b9cd1928bd7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Add a text node from a float. <br /></td></tr>
<tr class="separator:a1dbb1390e829d0673af66b9cd1928bd7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa715302dfc09473c77c853cbd5431965" id="r_aa715302dfc09473c77c853cbd5431965"><td class="memItemLeft" align="right" valign="top"><a id="aa715302dfc09473c77c853cbd5431965" name="aa715302dfc09473c77c853cbd5431965"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>PushText</b> (double value)</td></tr>
<tr class="memdesc:aa715302dfc09473c77c853cbd5431965"><td class="mdescLeft">&#160;</td><td class="mdescRight">Add a text node from a double. <br /></td></tr>
<tr class="separator:aa715302dfc09473c77c853cbd5431965"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afc8416814219591c2fd5656e0c233140" id="r_afc8416814219591c2fd5656e0c233140"><td class="memItemLeft" align="right" valign="top"><a id="afc8416814219591c2fd5656e0c233140" name="afc8416814219591c2fd5656e0c233140"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>PushComment</b> (const char *comment)</td></tr>
<tr class="memdesc:afc8416814219591c2fd5656e0c233140"><td class="mdescLeft">&#160;</td><td class="mdescRight">Add a comment. <br /></td></tr>
<tr class="separator:afc8416814219591c2fd5656e0c233140"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a73eba3d1aab34c4c3ac38d7d2d186671" id="r_a73eba3d1aab34c4c3ac38d7d2d186671"><td class="memItemLeft" align="right" valign="top"><a id="a73eba3d1aab34c4c3ac38d7d2d186671" name="a73eba3d1aab34c4c3ac38d7d2d186671"></a>
virtual bool&#160;</td><td class="memItemRight" valign="bottom"><b>VisitEnter</b> (const <a class="el" href="classtinyxml2_1_1_x_m_l_document.html">XMLDocument</a> &amp;) override</td></tr>
<tr class="memdesc:a73eba3d1aab34c4c3ac38d7d2d186671"><td class="mdescLeft">&#160;</td><td class="mdescRight">Visit a document. <br /></td></tr>
<tr class="separator:a73eba3d1aab34c4c3ac38d7d2d186671"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a261a24986e3507258a74405a7dc08cbf" id="r_a261a24986e3507258a74405a7dc08cbf"><td class="memItemLeft" align="right" valign="top"><a id="a261a24986e3507258a74405a7dc08cbf" name="a261a24986e3507258a74405a7dc08cbf"></a>
virtual bool&#160;</td><td class="memItemRight" valign="bottom"><b>VisitExit</b> (const <a class="el" href="classtinyxml2_1_1_x_m_l_document.html">XMLDocument</a> &amp;) override</td></tr>
<tr class="memdesc:a261a24986e3507258a74405a7dc08cbf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Visit a document. <br /></td></tr>
<tr class="separator:a261a24986e3507258a74405a7dc08cbf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5cab997d51b0387c21e2274bd1147755" id="r_a5cab997d51b0387c21e2274bd1147755"><td class="memItemLeft" align="right" valign="top"><a id="a5cab997d51b0387c21e2274bd1147755" name="a5cab997d51b0387c21e2274bd1147755"></a>
virtual bool&#160;</td><td class="memItemRight" valign="bottom"><b>VisitEnter</b> (const <a class="el" href="classtinyxml2_1_1_x_m_l_element.html">XMLElement</a> &amp;element, const <a class="el" href="classtinyxml2_1_1_x_m_l_attribute.html">XMLAttribute</a> *attribute) override</td></tr>
<tr class="memdesc:a5cab997d51b0387c21e2274bd1147755"><td class="mdescLeft">&#160;</td><td class="mdescRight">Visit an element. <br /></td></tr>
<tr class="separator:a5cab997d51b0387c21e2274bd1147755"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9a397f4c809a4de7ba27902b3ae1bbf7" id="r_a9a397f4c809a4de7ba27902b3ae1bbf7"><td class="memItemLeft" align="right" valign="top"><a id="a9a397f4c809a4de7ba27902b3ae1bbf7" name="a9a397f4c809a4de7ba27902b3ae1bbf7"></a>
virtual bool&#160;</td><td class="memItemRight" valign="bottom"><b>VisitExit</b> (const <a class="el" href="classtinyxml2_1_1_x_m_l_element.html">XMLElement</a> &amp;element) override</td></tr>
<tr class="memdesc:a9a397f4c809a4de7ba27902b3ae1bbf7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Visit an element. <br /></td></tr>
<tr class="separator:a9a397f4c809a4de7ba27902b3ae1bbf7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad903ea1672831f797130b4cddddfa532" id="r_ad903ea1672831f797130b4cddddfa532"><td class="memItemLeft" align="right" valign="top"><a id="ad903ea1672831f797130b4cddddfa532" name="ad903ea1672831f797130b4cddddfa532"></a>
virtual bool&#160;</td><td class="memItemRight" valign="bottom"><b>Visit</b> (const <a class="el" href="classtinyxml2_1_1_x_m_l_text.html">XMLText</a> &amp;text) override</td></tr>
<tr class="memdesc:ad903ea1672831f797130b4cddddfa532"><td class="mdescLeft">&#160;</td><td class="mdescRight">Visit a text node. <br /></td></tr>
<tr class="separator:ad903ea1672831f797130b4cddddfa532"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a76fe434cdd4c39cb9963e3025e53609a" id="r_a76fe434cdd4c39cb9963e3025e53609a"><td class="memItemLeft" align="right" valign="top"><a id="a76fe434cdd4c39cb9963e3025e53609a" name="a76fe434cdd4c39cb9963e3025e53609a"></a>
virtual bool&#160;</td><td class="memItemRight" valign="bottom"><b>Visit</b> (const <a class="el" href="classtinyxml2_1_1_x_m_l_comment.html">XMLComment</a> &amp;comment) override</td></tr>
<tr class="memdesc:a76fe434cdd4c39cb9963e3025e53609a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Visit a comment node. <br /></td></tr>
<tr class="separator:a76fe434cdd4c39cb9963e3025e53609a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a63df55647c0e170e5b8702842b82008e" id="r_a63df55647c0e170e5b8702842b82008e"><td class="memItemLeft" align="right" valign="top"><a id="a63df55647c0e170e5b8702842b82008e" name="a63df55647c0e170e5b8702842b82008e"></a>
virtual bool&#160;</td><td class="memItemRight" valign="bottom"><b>Visit</b> (const <a class="el" href="classtinyxml2_1_1_x_m_l_declaration.html">XMLDeclaration</a> &amp;declaration) override</td></tr>
<tr class="memdesc:a63df55647c0e170e5b8702842b82008e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Visit a declaration. <br /></td></tr>
<tr class="separator:a63df55647c0e170e5b8702842b82008e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a31002765840bc4ea7b22332f71d83c74" id="r_a31002765840bc4ea7b22332f71d83c74"><td class="memItemLeft" align="right" valign="top"><a id="a31002765840bc4ea7b22332f71d83c74" name="a31002765840bc4ea7b22332f71d83c74"></a>
virtual bool&#160;</td><td class="memItemRight" valign="bottom"><b>Visit</b> (const <a class="el" href="classtinyxml2_1_1_x_m_l_unknown.html">XMLUnknown</a> &amp;unknown) override</td></tr>
<tr class="memdesc:a31002765840bc4ea7b22332f71d83c74"><td class="mdescLeft">&#160;</td><td class="mdescRight">Visit an unknown node. <br /></td></tr>
<tr class="separator:a31002765840bc4ea7b22332f71d83c74"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abfa772366c44a17cdeb8aea294d57f78" id="r_abfa772366c44a17cdeb8aea294d57f78"><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#abfa772366c44a17cdeb8aea294d57f78">CStr</a> () const</td></tr>
<tr class="separator:abfa772366c44a17cdeb8aea294d57f78"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3256cf3523d4898b91abb18b924be04c" id="r_a3256cf3523d4898b91abb18b924be04c"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a3256cf3523d4898b91abb18b924be04c">CStrSize</a> () const</td></tr>
<tr class="separator:a3256cf3523d4898b91abb18b924be04c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a690cb140ba98b7339734ff865f56b0b3" id="r_a690cb140ba98b7339734ff865f56b0b3"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a690cb140ba98b7339734ff865f56b0b3">ClearBuffer</a> (bool resetToFirstElement=true)</td></tr>
<tr class="separator:a690cb140ba98b7339734ff865f56b0b3"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pro-methods" name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr class="memitem:a01148e2ebe6776e38c5a3e41bc5feb74" id="r_a01148e2ebe6776e38c5a3e41bc5feb74"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a01148e2ebe6776e38c5a3e41bc5feb74">PrintSpace</a> (int depth)</td></tr>
<tr class="separator:a01148e2ebe6776e38c5a3e41bc5feb74"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Printing functionality. The <a class="el" href="classtinyxml2_1_1_x_m_l_printer.html">XMLPrinter</a> gives you more options than the <a class="el" href="classtinyxml2_1_1_x_m_l_document.html#a867cf5fa3e3ff6ae4847a8b7ee8ec083">XMLDocument::Print()</a> method.</p>
<p>It can:</p><ol type="1">
<li>Print to memory.</li>
<li>Print to a file you provide.</li>
<li>Print XML without a <a class="el" href="classtinyxml2_1_1_x_m_l_document.html">XMLDocument</a>.</li>
</ol>
<p>Print to Memory</p>
<pre class="fragment">XMLPrinter printer;
doc.Print( &amp;printer );
SomeFunction( printer.CStr() );
</pre><p>Print to a File</p>
<p>You provide the file pointer. </p><pre class="fragment">XMLPrinter printer( fp );
doc.Print( &amp;printer );
</pre><p>Print without a <a class="el" href="classtinyxml2_1_1_x_m_l_document.html">XMLDocument</a></p>
<p>When loading, an XML parser is very useful. However, sometimes when saving, it just gets in the way. The code is often set up for streaming, and constructing the DOM is just overhead.</p>
<p>The Printer supports the streaming case. The following code prints out a trivially simple XML file without ever creating an XML document.</p>
<pre class="fragment">XMLPrinter printer( fp );
printer.OpenElement( "foo" );
printer.PushAttribute( "foo", "bar" );
printer.CloseElement();
</pre> </div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="aa6d3841c069085f5b8a27bc7103c04f7" name="aa6d3841c069085f5b8a27bc7103c04f7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa6d3841c069085f5b8a27bc7103c04f7">&#9670;&#160;</a></span>XMLPrinter()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">tinyxml2::XMLPrinter::XMLPrinter </td>
<td>(</td>
<td class="paramtype">FILE *</td> <td class="paramname"><span class="paramname"><em>file</em><span class="paramdefsep"> = </span><span class="paramdefval">0</span>, </span></td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool</td> <td class="paramname"><span class="paramname"><em>compact</em><span class="paramdefsep"> = </span><span class="paramdefval">false</span>, </span></td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int</td> <td class="paramname"><span class="paramname"><em>depth</em><span class="paramdefsep"> = </span><span class="paramdefval">0</span></span>&#160;)</td>
</tr>
</table>
</div><div class="memdoc">
<p>Construct the printer. If the FILE* is specified, this will print to the FILE. Else it will print to memory, and the result is available in <a class="el" href="#abfa772366c44a17cdeb8aea294d57f78">CStr()</a>. If 'compact' is set to true, then output is created with only required whitespace and newlines. </p>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a690cb140ba98b7339734ff865f56b0b3" name="a690cb140ba98b7339734ff865f56b0b3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a690cb140ba98b7339734ff865f56b0b3">&#9670;&#160;</a></span>ClearBuffer()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void tinyxml2::XMLPrinter::ClearBuffer </td>
<td>(</td>
<td class="paramtype">bool</td> <td class="paramname"><span class="paramname"><em>resetToFirstElement</em><span class="paramdefsep"> = </span><span class="paramdefval">true</span></span></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>If in print to memory mode, reset the buffer to the beginning. </p>
</div>
</div>
<a id="abfa772366c44a17cdeb8aea294d57f78" name="abfa772366c44a17cdeb8aea294d57f78"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abfa772366c44a17cdeb8aea294d57f78">&#9670;&#160;</a></span>CStr()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">const char * tinyxml2::XMLPrinter::CStr </td>
<td>(</td>
<td class="paramname"><span class="paramname"></span></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>If in print to memory mode, return a pointer to the XML file in memory. </p>
</div>
</div>
<a id="a3256cf3523d4898b91abb18b924be04c" name="a3256cf3523d4898b91abb18b924be04c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3256cf3523d4898b91abb18b924be04c">&#9670;&#160;</a></span>CStrSize()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">int tinyxml2::XMLPrinter::CStrSize </td>
<td>(</td>
<td class="paramname"><span class="paramname"></span></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>If in print to memory mode, return the size of the XML file in memory. (Note the size returned includes the terminating null.) </p>
</div>
</div>
<a id="a20fb06c83bd13e5140d7dd13af06c010" name="a20fb06c83bd13e5140d7dd13af06c010"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a20fb06c83bd13e5140d7dd13af06c010">&#9670;&#160;</a></span>OpenElement()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void tinyxml2::XMLPrinter::OpenElement </td>
<td>(</td>
<td class="paramtype">const char *</td> <td class="paramname"><span class="paramname"><em>name</em>, </span></td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool</td> <td class="paramname"><span class="paramname"><em>compactMode</em><span class="paramdefsep"> = </span><span class="paramdefval">false</span></span>&#160;)</td>
</tr>
</table>
</div><div class="memdoc">
<p>If streaming, start writing an element. The element must be closed with <a class="el" href="#ad04d29562b46fcdb23ab320f8b664240" title="If streaming, close the Element.">CloseElement()</a> </p>
</div>
</div>
<a id="a01148e2ebe6776e38c5a3e41bc5feb74" name="a01148e2ebe6776e38c5a3e41bc5feb74"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a01148e2ebe6776e38c5a3e41bc5feb74">&#9670;&#160;</a></span>PrintSpace()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual void tinyxml2::XMLPrinter::PrintSpace </td>
<td>(</td>
<td class="paramtype">int</td> <td class="paramname"><span class="paramname"><em>depth</em></span></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Prints out the space before an element. You may override to change the space and tabs used. A <a class="el" href="#a01148e2ebe6776e38c5a3e41bc5feb74">PrintSpace()</a> override should call Print(). </p>
</div>
</div>
<a id="a178c608ce8476043d5d6513819cde903" name="a178c608ce8476043d5d6513819cde903"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a178c608ce8476043d5d6513819cde903">&#9670;&#160;</a></span>PushHeader()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void tinyxml2::XMLPrinter::PushHeader </td>
<td>(</td>
<td class="paramtype">bool</td> <td class="paramname"><span class="paramname"><em>writeBOM</em>, </span></td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool</td> <td class="paramname"><span class="paramname"><em>writeDeclaration</em></span>&#160;)</td>
</tr>
</table>
</div><div class="memdoc">
<p>If streaming, write the BOM and declaration. </p>
</div>
</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&#160;<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>