📄 classtixmldocument.html
字号:
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Returns the location (if known) of the error.
<p>
The 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>
<dl compact><dt><b>See also:</b></dt><dd><a class="el" href="classTiXmlDocument.html#a22">SetTabSize</a>, <a class="el" href="classTiXmlBase.html#a3">Row</a>, <a class="el" href="classTiXmlBase.html#a4">Column</a></dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="a12"></a><!-- doxytag: member="TiXmlDocument::LoadFile" ref="a12" args="(const std::string &filename, TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">bool TiXmlDocument::LoadFile </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const std::string & </td>
<td class="mdname" nowrap> <em>filename</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>TiXmlEncoding </td>
<td class="mdname" nowrap> <em>encoding</em> = <code>TIXML_DEFAULT_ENCODING</code></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [inline]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
<dl compact><dt><b>Parameters: </b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><em>encoding</em> </td><td>
STL std::string version. </td></tr>
</table>
</dl> </td>
</tr>
</table>
<a class="anchor" name="a10"></a><!-- doxytag: member="TiXmlDocument::LoadFile" ref="a10" args="(FILE *, TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">bool TiXmlDocument::LoadFile </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">FILE * </td>
<td class="mdname" nowrap>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>TiXmlEncoding </td>
<td class="mdname" nowrap> <em>encoding</em> = <code>TIXML_DEFAULT_ENCODING</code></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">) </td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Load a file using the given FILE*.
<p>
Returns true if successful. Note that this method doesn't stream - the entire object pointed at by the FILE* will be interpreted as an XML file. TinyXML doesn't stream in XML from the current file location. Streaming may be added in the future. </td>
</tr>
</table>
<a class="anchor" name="a6"></a><!-- doxytag: member="TiXmlDocument::LoadFile" ref="a6" args="(TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">bool TiXmlDocument::LoadFile </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">TiXmlEncoding </td>
<td class="mdname1" valign="top" nowrap> <em>encoding</em> = <code>TIXML_DEFAULT_ENCODING</code> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Load a file using the current document value.
<p>
Returns true if successful. Will delete any existing document data before loading. </td>
</tr>
</table>
<a class="anchor" name="a14"></a><!-- doxytag: member="TiXmlDocument::Parse" ref="a14" args="(const char *p, TiXmlParsingData *data=0, TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">virtual const char* TiXmlDocument::Parse </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const char * </td>
<td class="mdname" nowrap> <em>p</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>TiXmlParsingData * </td>
<td class="mdname" nowrap> <em>data</em> = <code>0</code>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>TiXmlEncoding </td>
<td class="mdname" nowrap> <em>encoding</em> = <code>TIXML_DEFAULT_ENCODING</code></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [virtual]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Parse the given null terminated block of xml data.
<p>
Passing 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.
<p>
Implements <a class="el" href="classTiXmlBase.html">TiXmlBase</a>. </td>
</tr>
</table>
<a class="anchor" name="a15"></a><!-- doxytag: member="TiXmlDocument::RootElement" ref="a15" args="() const " --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">const <a class="el" href="classTiXmlElement.html">TiXmlElement</a>* TiXmlDocument::RootElement </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap> const<code> [inline]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Get the root element -- the only top level element -- of the document.
<p>
In well formed XML, there should only be one. TinyXml is tolerant of multiple elements at the document level. </td>
</tr>
</table>
<a class="anchor" name="a22"></a><!-- doxytag: member="TiXmlDocument::SetTabSize" ref="a22" args="(int _tabsize)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">void TiXmlDocument::SetTabSize </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">int </td>
<td class="mdname1" valign="top" nowrap> <em>_tabsize</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [inline]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
<a class="el" href="classTiXmlDocument.html#a22">SetTabSize()</a> allows the error reporting functions (<a class="el" href="classTiXmlDocument.html#a20">ErrorRow()</a> and <a class="el" href="classTiXmlDocument.html#a21">ErrorCol()</a>) to report the correct values for row and column.
<p>
It does not change the output or input in any way.<p>
By 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>
The 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>
Note that row and column tracking is not supported when using operator>>.<p>
The tab size needs to be enabled before the parse or load. Correct usage: <div class="fragment"><pre class="fragment"> TiXmlDocument doc;
doc.SetTabSize( 8 );
doc.Load( "myfile.xml" );
</pre></div><p>
<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>
</td>
</tr>
</table>
<hr>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="tinyxml_8h-source.html">tinyxml.h</a></ul>
<hr size="1"><address style="align: right;"><small>Generated on Sun Jan 15 23:12:04 2006 for TinyXml by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.4 </small></address>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -