• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
3<title>TinyXml: TiXmlDocument Class Reference</title>
4<link href="doxygen.css" rel="stylesheet" type="text/css">
5</head><body>
6<!-- Generated by Doxygen 1.4.4 -->
7<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a></div>
8<h1>TiXmlDocument Class Reference</h1><!-- doxytag: class="TiXmlDocument" --><!-- doxytag: inherits="TiXmlNode" -->Always the top level node.
9<a href="#_details">More...</a>
10<p>
11<code>#include &lt;<a class="el" href="tinyxml_8h-source.html">tinyxml.h</a>&gt;</code>
12<p>
13<p>Inheritance diagram for TiXmlDocument:
14<p><center><img src="classTiXmlDocument.png" usemap="#TiXmlDocument_map" border="0" alt=""></center>
15<map name="TiXmlDocument_map">
16<area href="classTiXmlNode.html" alt="TiXmlNode" shape="rect" coords="0,56,99,80">
17<area href="classTiXmlBase.html" alt="TiXmlBase" shape="rect" coords="0,0,99,24">
18</map>
19<a href="classTiXmlDocument-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
20<tr><td></td></tr>
21<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
22<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a0"></a><!-- doxytag: member="TiXmlDocument::TiXmlDocument" ref="a0" args="()" -->
23&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlDocument.html#a0">TiXmlDocument</a> ()</td></tr>
24
25<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Create an empty document, that has no name. <br></td></tr>
26<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a1"></a><!-- doxytag: member="TiXmlDocument::TiXmlDocument" ref="a1" args="(const char *documentName)" -->
27&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlDocument.html#a1">TiXmlDocument</a> (const char *documentName)</td></tr>
28
29<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Create a document with a name. The name of the document is also the filename of the xml. <br></td></tr>
30<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a2"></a><!-- doxytag: member="TiXmlDocument::TiXmlDocument" ref="a2" args="(const std::string &amp;documentName)" -->
31&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlDocument.html#a2">TiXmlDocument</a> (const std::string &amp;documentName)</td></tr>
32
33<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Constructor. <br></td></tr>
34<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlDocument.html#a6">LoadFile</a> (TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)</td></tr>
35
36<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Load a file using the current document value.  <a href="#a6"></a><br></td></tr>
37<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a7"></a><!-- doxytag: member="TiXmlDocument::SaveFile" ref="a7" args="() const " -->
38bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlDocument.html#a7">SaveFile</a> () const </td></tr>
39
40<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Save a file using the current document value. Returns true if successful. <br></td></tr>
41<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a8"></a><!-- doxytag: member="TiXmlDocument::LoadFile" ref="a8" args="(const char *filename, TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)" -->
42bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlDocument.html#a8">LoadFile</a> (const char *filename, TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)</td></tr>
43
44<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Load a file using the given filename. Returns true if successful. <br></td></tr>
45<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a9"></a><!-- doxytag: member="TiXmlDocument::SaveFile" ref="a9" args="(const char *filename) const " -->
46bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlDocument.html#a9">SaveFile</a> (const char *filename) const </td></tr>
47
48<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Save a file using the given filename. Returns true if successful. <br></td></tr>
49<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlDocument.html#a10">LoadFile</a> (const std::string &amp;filename, TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)</td></tr>
50
51<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a11"></a><!-- doxytag: member="TiXmlDocument::SaveFile" ref="a11" args="(const std::string &amp;filename) const " -->
52bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlDocument.html#a11">SaveFile</a> (const std::string &amp;filename) const </td></tr>
53
54<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">&lt; STL std::string version. <br></td></tr>
55<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual const char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlDocument.html#a12">Parse</a> (const char *p, TiXmlParsingData *data=0, TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)</td></tr>
56
57<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Parse the given null terminated block of xml data.  <a href="#a12"></a><br></td></tr>
58<tr><td class="memItemLeft" nowrap align="right" valign="top">const <a class="el" href="classTiXmlElement.html">TiXmlElement</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlDocument.html#a13">RootElement</a> () const </td></tr>
59
60<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the root element -- the only top level element -- of the document.  <a href="#a13"></a><br></td></tr>
61<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlDocument.html#a15">Error</a> () const </td></tr>
62
63<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">If an error occurs, Error will be set to true.  <a href="#a15"></a><br></td></tr>
64<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a16"></a><!-- doxytag: member="TiXmlDocument::ErrorDesc" ref="a16" args="() const " -->
65const char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlDocument.html#a16">ErrorDesc</a> () const </td></tr>
66
67<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Contains a textual (english) description of the error if one occurs. <br></td></tr>
68<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlDocument.html#a17">ErrorId</a> () const </td></tr>
69
70<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Generally, you probably want the error string ( <a class="el" href="classTiXmlDocument.html#a16">ErrorDesc()</a> ).  <a href="#a17"></a><br></td></tr>
71<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlDocument.html#a18">ErrorRow</a> ()</td></tr>
72
73<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the location (if known) of the error.  <a href="#a18"></a><br></td></tr>
74<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a19"></a><!-- doxytag: member="TiXmlDocument::ErrorCol" ref="a19" args="()" -->
75int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlDocument.html#a19">ErrorCol</a> ()</td></tr>
76
77<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The column where the error occured. See <a class="el" href="classTiXmlDocument.html#a18">ErrorRow()</a>. <br></td></tr>
78<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlDocument.html#a20">SetTabSize</a> (int _tabsize)</td></tr>
79
80<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><a class="el" href="classTiXmlDocument.html#a20">SetTabSize()</a> allows the error reporting functions (<a class="el" href="classTiXmlDocument.html#a18">ErrorRow()</a> and <a class="el" href="classTiXmlDocument.html#a19">ErrorCol()</a>) to report the correct values for row and column.  <a href="#a20"></a><br></td></tr>
81<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlDocument.html#a22">ClearError</a> ()</td></tr>
82
83<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">If you have handled the error, it can be reset with this call.  <a href="#a22"></a><br></td></tr>
84<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a23"></a><!-- doxytag: member="TiXmlDocument::Print" ref="a23" args="() const " -->
85void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlDocument.html#a23">Print</a> () const </td></tr>
86
87<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Dump the document to standard out. <br></td></tr>
88<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a24"></a><!-- doxytag: member="TiXmlDocument::Print" ref="a24" args="(FILE *cfile, int depth=0) const " -->
89virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlDocument.html#a24">Print</a> (FILE *cfile, int depth=0) const </td></tr>
90
91<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Print this Document to a FILE stream. <br></td></tr>
92<tr><td colspan="2"><br><h2>Protected Member Functions</h2></td></tr>
93<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual <a class="el" href="classTiXmlNode.html">TiXmlNode</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlDocument.html#b1">Clone</a> () const </td></tr>
94
95<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Create an exact duplicate of this node and return it.  <a href="#b1"></a><br></td></tr>
96</table>
97<hr><a name="_details"></a><h2>Detailed Description</h2>
98Always the top level node.
99<p>
100A document binds together all the XML pieces. It can be saved, loaded, and printed to the screen. The 'value' of a document node is the xml file name.
101<p>
102<hr><h2>Member Function Documentation</h2>
103<a class="anchor" name="a22"></a><!-- doxytag: member="TiXmlDocument::ClearError" ref="a22" args="()" --><p>
104<table class="mdTable" cellpadding="2" cellspacing="0">
105  <tr>
106    <td class="mdRow">
107      <table cellpadding="0" cellspacing="0" border="0">
108        <tr>
109          <td class="md" nowrap valign="top">void TiXmlDocument::ClearError           </td>
110          <td class="md" valign="top">(&nbsp;</td>
111          <td class="mdname1" valign="top" nowrap>          </td>
112          <td class="md" valign="top">&nbsp;)&nbsp;</td>
113          <td class="md" nowrap><code> [inline]</code></td>
114        </tr>
115      </table>
116    </td>
117  </tr>
118</table>
119<table cellspacing="5" cellpadding="0" border="0">
120  <tr>
121    <td>
122      &nbsp;
123    </td>
124    <td>
125
126<p>
127If you have handled the error, it can be reset with this call.
128<p>
129The error state is automatically cleared if you Parse a new XML block.    </td>
130  </tr>
131</table>
132<a class="anchor" name="b1"></a><!-- doxytag: member="TiXmlDocument::Clone" ref="b1" args="() const " --><p>
133<table class="mdTable" cellpadding="2" cellspacing="0">
134  <tr>
135    <td class="mdRow">
136      <table cellpadding="0" cellspacing="0" border="0">
137        <tr>
138          <td class="md" nowrap valign="top">virtual <a class="el" href="classTiXmlNode.html">TiXmlNode</a>* TiXmlDocument::Clone           </td>
139          <td class="md" valign="top">(&nbsp;</td>
140          <td class="mdname1" valign="top" nowrap>          </td>
141          <td class="md" valign="top">&nbsp;)&nbsp;</td>
142          <td class="md" nowrap> const<code> [protected, virtual]</code></td>
143        </tr>
144      </table>
145    </td>
146  </tr>
147</table>
148<table cellspacing="5" cellpadding="0" border="0">
149  <tr>
150    <td>
151      &nbsp;
152    </td>
153    <td>
154
155<p>
156Create an exact duplicate of this node and return it.
157<p>
158The memory must be deleted by the caller.
159<p>
160Implements <a class="el" href="classTiXmlNode.html#a72">TiXmlNode</a>.    </td>
161  </tr>
162</table>
163<a class="anchor" name="a15"></a><!-- doxytag: member="TiXmlDocument::Error" ref="a15" args="() const " --><p>
164<table class="mdTable" cellpadding="2" cellspacing="0">
165  <tr>
166    <td class="mdRow">
167      <table cellpadding="0" cellspacing="0" border="0">
168        <tr>
169          <td class="md" nowrap valign="top">bool TiXmlDocument::Error           </td>
170          <td class="md" valign="top">(&nbsp;</td>
171          <td class="mdname1" valign="top" nowrap>          </td>
172          <td class="md" valign="top">&nbsp;)&nbsp;</td>
173          <td class="md" nowrap> const<code> [inline]</code></td>
174        </tr>
175      </table>
176    </td>
177  </tr>
178</table>
179<table cellspacing="5" cellpadding="0" border="0">
180  <tr>
181    <td>
182      &nbsp;
183    </td>
184    <td>
185
186<p>
187If an error occurs, Error will be set to true.
188<p>
189Also,<ul>
190<li>The <a class="el" href="classTiXmlDocument.html#a17">ErrorId()</a> will contain the integer identifier of the error (not generally useful)</li><li>The <a class="el" href="classTiXmlDocument.html#a16">ErrorDesc()</a> method will return the name of the error. (very useful)</li><li>The <a class="el" href="classTiXmlDocument.html#a18">ErrorRow()</a> and <a class="el" href="classTiXmlDocument.html#a19">ErrorCol()</a> will return the location of the error (if known)</li></ul>
191    </td>
192  </tr>
193</table>
194<a class="anchor" name="a17"></a><!-- doxytag: member="TiXmlDocument::ErrorId" ref="a17" args="() const " --><p>
195<table class="mdTable" cellpadding="2" cellspacing="0">
196  <tr>
197    <td class="mdRow">
198      <table cellpadding="0" cellspacing="0" border="0">
199        <tr>
200          <td class="md" nowrap valign="top">int TiXmlDocument::ErrorId           </td>
201          <td class="md" valign="top">(&nbsp;</td>
202          <td class="mdname1" valign="top" nowrap>          </td>
203          <td class="md" valign="top">&nbsp;)&nbsp;</td>
204          <td class="md" nowrap> const<code> [inline]</code></td>
205        </tr>
206      </table>
207    </td>
208  </tr>
209</table>
210<table cellspacing="5" cellpadding="0" border="0">
211  <tr>
212    <td>
213      &nbsp;
214    </td>
215    <td>
216
217<p>
218Generally, you probably want the error string ( <a class="el" href="classTiXmlDocument.html#a16">ErrorDesc()</a> ).
219<p>
220But if you prefer the ErrorId, this function will fetch it.    </td>
221  </tr>
222</table>
223<a class="anchor" name="a18"></a><!-- doxytag: member="TiXmlDocument::ErrorRow" ref="a18" args="()" --><p>
224<table class="mdTable" cellpadding="2" cellspacing="0">
225  <tr>
226    <td class="mdRow">
227      <table cellpadding="0" cellspacing="0" border="0">
228        <tr>
229          <td class="md" nowrap valign="top">int TiXmlDocument::ErrorRow           </td>
230          <td class="md" valign="top">(&nbsp;</td>
231          <td class="mdname1" valign="top" nowrap>          </td>
232          <td class="md" valign="top">&nbsp;)&nbsp;</td>
233          <td class="md" nowrap><code> [inline]</code></td>
234        </tr>
235      </table>
236    </td>
237  </tr>
238</table>
239<table cellspacing="5" cellpadding="0" border="0">
240  <tr>
241    <td>
242      &nbsp;
243    </td>
244    <td>
245
246<p>
247Returns the location (if known) of the error.
248<p>
249The first column is column 1, and the first row is row 1. A value of 0 means the row and column wasn't applicable (memory errors, for example, have no row/column) or the parser lost the error. (An error in the error reporting, in that case.)<p>
250<dl compact><dt><b>See also:</b></dt><dd><a class="el" href="classTiXmlDocument.html#a20">SetTabSize</a>, <a class="el" href="classTiXmlBase.html#a3">Row</a>, <a class="el" href="classTiXmlBase.html#a4">Column</a></dd></dl>
251    </td>
252  </tr>
253</table>
254<a class="anchor" name="a10"></a><!-- doxytag: member="TiXmlDocument::LoadFile" ref="a10" args="(const std::string &amp;filename, TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)" --><p>
255<table class="mdTable" cellpadding="2" cellspacing="0">
256  <tr>
257    <td class="mdRow">
258      <table cellpadding="0" cellspacing="0" border="0">
259        <tr>
260          <td class="md" nowrap valign="top">bool TiXmlDocument::LoadFile           </td>
261          <td class="md" valign="top">(&nbsp;</td>
262          <td class="md" nowrap valign="top">const std::string &amp;&nbsp;</td>
263          <td class="mdname" nowrap> <em>filename</em>, </td>
264        </tr>
265        <tr>
266          <td class="md" nowrap align="right"></td>
267          <td class="md"></td>
268          <td class="md" nowrap>TiXmlEncoding&nbsp;</td>
269          <td class="mdname" nowrap> <em>encoding</em> = <code>TIXML_DEFAULT_ENCODING</code></td>
270        </tr>
271        <tr>
272          <td class="md"></td>
273          <td class="md">)&nbsp;</td>
274          <td class="md" colspan="2"><code> [inline]</code></td>
275        </tr>
276      </table>
277    </td>
278  </tr>
279</table>
280<table cellspacing="5" cellpadding="0" border="0">
281  <tr>
282    <td>
283      &nbsp;
284    </td>
285    <td>
286
287<p>
288<dl compact><dt><b>Parameters: </b></dt><dd>
289<table border="0" cellspacing="2" cellpadding="0">
290<tr><td valign="top"><em>encoding</em>&nbsp;</td><td>
291STL std::string version. </td></tr>
292</table>
293</dl>    </td>
294  </tr>
295</table>
296<a class="anchor" name="a6"></a><!-- doxytag: member="TiXmlDocument::LoadFile" ref="a6" args="(TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)" --><p>
297<table class="mdTable" cellpadding="2" cellspacing="0">
298  <tr>
299    <td class="mdRow">
300      <table cellpadding="0" cellspacing="0" border="0">
301        <tr>
302          <td class="md" nowrap valign="top">bool TiXmlDocument::LoadFile           </td>
303          <td class="md" valign="top">(&nbsp;</td>
304          <td class="md" nowrap valign="top">TiXmlEncoding&nbsp;</td>
305          <td class="mdname1" valign="top" nowrap> <em>encoding</em> = <code>TIXML_DEFAULT_ENCODING</code>          </td>
306          <td class="md" valign="top">&nbsp;)&nbsp;</td>
307          <td class="md" nowrap></td>
308        </tr>
309      </table>
310    </td>
311  </tr>
312</table>
313<table cellspacing="5" cellpadding="0" border="0">
314  <tr>
315    <td>
316      &nbsp;
317    </td>
318    <td>
319
320<p>
321Load a file using the current document value.
322<p>
323Returns true if successful. Will delete any existing document data before loading.    </td>
324  </tr>
325</table>
326<a class="anchor" name="a12"></a><!-- doxytag: member="TiXmlDocument::Parse" ref="a12" args="(const char *p, TiXmlParsingData *data=0, TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)" --><p>
327<table class="mdTable" cellpadding="2" cellspacing="0">
328  <tr>
329    <td class="mdRow">
330      <table cellpadding="0" cellspacing="0" border="0">
331        <tr>
332          <td class="md" nowrap valign="top">virtual const char* TiXmlDocument::Parse           </td>
333          <td class="md" valign="top">(&nbsp;</td>
334          <td class="md" nowrap valign="top">const char *&nbsp;</td>
335          <td class="mdname" nowrap> <em>p</em>, </td>
336        </tr>
337        <tr>
338          <td class="md" nowrap align="right"></td>
339          <td class="md"></td>
340          <td class="md" nowrap>TiXmlParsingData *&nbsp;</td>
341          <td class="mdname" nowrap> <em>data</em> = <code>0</code>, </td>
342        </tr>
343        <tr>
344          <td class="md" nowrap align="right"></td>
345          <td class="md"></td>
346          <td class="md" nowrap>TiXmlEncoding&nbsp;</td>
347          <td class="mdname" nowrap> <em>encoding</em> = <code>TIXML_DEFAULT_ENCODING</code></td>
348        </tr>
349        <tr>
350          <td class="md"></td>
351          <td class="md">)&nbsp;</td>
352          <td class="md" colspan="2"><code> [virtual]</code></td>
353        </tr>
354      </table>
355    </td>
356  </tr>
357</table>
358<table cellspacing="5" cellpadding="0" border="0">
359  <tr>
360    <td>
361      &nbsp;
362    </td>
363    <td>
364
365<p>
366Parse the given null terminated block of xml data.
367<p>
368Passing in an encoding to this method (either TIXML_ENCODING_LEGACY or TIXML_ENCODING_UTF8 will force TinyXml to use that encoding, regardless of what TinyXml might otherwise try to detect.
369<p>
370Implements <a class="el" href="classTiXmlBase.html">TiXmlBase</a>.    </td>
371  </tr>
372</table>
373<a class="anchor" name="a13"></a><!-- doxytag: member="TiXmlDocument::RootElement" ref="a13" args="() const " --><p>
374<table class="mdTable" cellpadding="2" cellspacing="0">
375  <tr>
376    <td class="mdRow">
377      <table cellpadding="0" cellspacing="0" border="0">
378        <tr>
379          <td class="md" nowrap valign="top">const <a class="el" href="classTiXmlElement.html">TiXmlElement</a>* TiXmlDocument::RootElement           </td>
380          <td class="md" valign="top">(&nbsp;</td>
381          <td class="mdname1" valign="top" nowrap>          </td>
382          <td class="md" valign="top">&nbsp;)&nbsp;</td>
383          <td class="md" nowrap> const<code> [inline]</code></td>
384        </tr>
385      </table>
386    </td>
387  </tr>
388</table>
389<table cellspacing="5" cellpadding="0" border="0">
390  <tr>
391    <td>
392      &nbsp;
393    </td>
394    <td>
395
396<p>
397Get the root element -- the only top level element -- of the document.
398<p>
399In well formed XML, there should only be one. TinyXml is tolerant of multiple elements at the document level.    </td>
400  </tr>
401</table>
402<a class="anchor" name="a20"></a><!-- doxytag: member="TiXmlDocument::SetTabSize" ref="a20" args="(int _tabsize)" --><p>
403<table class="mdTable" cellpadding="2" cellspacing="0">
404  <tr>
405    <td class="mdRow">
406      <table cellpadding="0" cellspacing="0" border="0">
407        <tr>
408          <td class="md" nowrap valign="top">void TiXmlDocument::SetTabSize           </td>
409          <td class="md" valign="top">(&nbsp;</td>
410          <td class="md" nowrap valign="top">int&nbsp;</td>
411          <td class="mdname1" valign="top" nowrap> <em>_tabsize</em>          </td>
412          <td class="md" valign="top">&nbsp;)&nbsp;</td>
413          <td class="md" nowrap><code> [inline]</code></td>
414        </tr>
415      </table>
416    </td>
417  </tr>
418</table>
419<table cellspacing="5" cellpadding="0" border="0">
420  <tr>
421    <td>
422      &nbsp;
423    </td>
424    <td>
425
426<p>
427<a class="el" href="classTiXmlDocument.html#a20">SetTabSize()</a> allows the error reporting functions (<a class="el" href="classTiXmlDocument.html#a18">ErrorRow()</a> and <a class="el" href="classTiXmlDocument.html#a19">ErrorCol()</a>) to report the correct values for row and column.
428<p>
429It does not change the output or input in any way.<p>
430By calling this method, with a tab size greater than 0, the row and column of each node and attribute is stored when the file is loaded. Very useful for tracking the DOM back in to the source file.<p>
431The tab size is required for calculating the location of nodes. If not set, the default of 4 is used. The tabsize is set per document. Setting the tabsize to 0 disables row/column tracking.<p>
432Note that row and column tracking is not supported when using operator&gt;&gt;.<p>
433The tab size needs to be enabled before the parse or load. Correct usage: <div class="fragment"><pre class="fragment">		TiXmlDocument doc;
434		doc.SetTabSize( 8 );
435		doc.Load( "myfile.xml" );
436		</pre></div><p>
437<dl compact><dt><b>See also:</b></dt><dd><a class="el" href="classTiXmlBase.html#a3">Row</a>, <a class="el" href="classTiXmlBase.html#a4">Column</a></dd></dl>
438    </td>
439  </tr>
440</table>
441<hr>The documentation for this class was generated from the following file:<ul>
442<li><a class="el" href="tinyxml_8h-source.html">tinyxml.h</a></ul>
443<hr size="1"><address style="align: right;"><small>Generated on Sat Oct 8 14:15:30 2005 for TinyXml by&nbsp;
444<a href="http://www.doxygen.org/index.html">
445<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.4 </small></address>
446</body>
447</html>
448