⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 classtixmldocument.html

📁 xml文件处理多平台类
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>TiXmlDocument class Reference</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.2.18 --><center><a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; </center><hr><h1>TiXmlDocument Class Reference</h1>Always the top level node. <a href="#_details">More...</a><p><code>#include &lt;<a class="el" href="tinyxml_8h-source.html">tinyxml.h</a>&gt;</code><p><p>Inheritance diagram for TiXmlDocument:<p><center><img src="classTiXmlDocument.png" usemap="#TiXmlDocument_map" border="0" alt=""></center><map name="TiXmlDocument_map"><area href="classTiXmlNode.html" alt="TiXmlNode" shape="rect" coords="0,56,99,80"><area href="classTiXmlBase.html" alt="TiXmlBase" shape="rect" coords="0,0,99,24"></map><a href="classTiXmlDocument-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0><tr><td></td></tr><tr><td colspan=2><br><h2>Public Methods</h2></td></tr><tr><td nowrap align=right valign=top><a name="a0" doxytag="TiXmlDocument::TiXmlDocument"></a>&nbsp;</td><td valign=bottom><a class="el" href="classTiXmlDocument.html#a0">TiXmlDocument</a> ()</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Create an empty document, that has no name.</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a1" doxytag="TiXmlDocument::TiXmlDocument"></a>&nbsp;</td><td valign=bottom><a class="el" href="classTiXmlDocument.html#a1">TiXmlDocument</a> (const char *documentName)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Create a document with a name. The name of the document is also the filename of the xml.</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a2" doxytag="TiXmlDocument::TiXmlDocument"></a>&nbsp;</td><td valign=bottom><a class="el" href="classTiXmlDocument.html#a2">TiXmlDocument</a> (const std::string &amp;documentName)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Constructor.</em></font><br><br></td></tr><tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classTiXmlDocument.html#a6">LoadFile</a> (TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Load a file using the current document value.</em> <a href="#a6"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a7" doxytag="TiXmlDocument::SaveFile"></a>bool&nbsp;</td><td valign=bottom><a class="el" href="classTiXmlDocument.html#a7">SaveFile</a> () const</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Save a file using the current document value. Returns true if successful.</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a8" doxytag="TiXmlDocument::LoadFile"></a>bool&nbsp;</td><td valign=bottom><a class="el" href="classTiXmlDocument.html#a8">LoadFile</a> (const char *filename, TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Load a file using the given filename. Returns true if successful.</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a9" doxytag="TiXmlDocument::SaveFile"></a>bool&nbsp;</td><td valign=bottom><a class="el" href="classTiXmlDocument.html#a9">SaveFile</a> (const char *filename) const</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Save a file using the given filename. Returns true if successful.</em></font><br><br></td></tr><tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classTiXmlDocument.html#a10">LoadFile</a> (const std::string &amp;filename, TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)</td></tr><tr><td nowrap align=right valign=top><a name="a11" doxytag="TiXmlDocument::SaveFile"></a>bool&nbsp;</td><td valign=bottom><a class="el" href="classTiXmlDocument.html#a11">SaveFile</a> (const std::string &amp;filename) const</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>&lt; STL std::string version.</em></font><br><br></td></tr><tr><td nowrap align=right valign=top>virtual const char *&nbsp;</td><td valign=bottom><a class="el" href="classTiXmlDocument.html#a12">Parse</a> (const char *p, TiXmlParsingData *data=0, TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Parse the given null terminated block of xml data.</em> <a href="#a12"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a class="el" href="classTiXmlElement.html">TiXmlElement</a> *&nbsp;</td><td valign=bottom><a class="el" href="classTiXmlDocument.html#a13">RootElement</a> () const</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Get the root element -- the only top level element -- of the document.</em> <a href="#a13"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classTiXmlDocument.html#a14">Error</a> () const</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>If an error occurs, Error will be set to true.</em> <a href="#a14"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a15" doxytag="TiXmlDocument::ErrorDesc"></a>const char *&nbsp;</td><td valign=bottom><a class="el" href="classTiXmlDocument.html#a15">ErrorDesc</a> () const</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Contains a textual (english) description of the error if one occurs.</em></font><br><br></td></tr><tr><td nowrap align=right valign=top>const int&nbsp;</td><td valign=bottom><a class="el" href="classTiXmlDocument.html#a16">ErrorId</a> () const</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Generally, you probably want the error string ( <a class="el" href="classTiXmlDocument.html#a15">ErrorDesc()</a> ).</em> <a href="#a16"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="classTiXmlDocument.html#a17">ErrorRow</a> ()</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Returns the location (if known) of the error.</em> <a href="#a17"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a18" doxytag="TiXmlDocument::ErrorCol"></a>int&nbsp;</td><td valign=bottom><a class="el" href="classTiXmlDocument.html#a18">ErrorCol</a> ()</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>The column where the error occured. See <a class="el" href="classTiXmlDocument.html#a17">ErrorRow()</a>.</em></font><br><br></td></tr><tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classTiXmlDocument.html#a19">SetTabSize</a> (int _tabsize)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>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.</em> <a href="#a19"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classTiXmlDocument.html#a21">ClearError</a> ()</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>If you have handled the error, it can be reset with this call.</em> <a href="#a21"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a22" doxytag="TiXmlDocument::Print"></a>void&nbsp;</td><td valign=bottom><a class="el" href="classTiXmlDocument.html#a22">Print</a> () const</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Dump the document to standard out.</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a23" doxytag="TiXmlDocument::Print"></a>virtual void&nbsp;</td><td valign=bottom><a class="el" href="classTiXmlDocument.html#a23">Print</a> (FILE *cfile, int depth=0) const</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Print this Document to a FILE stream.</em></font><br><br></td></tr><tr><td colspan=2><br><h2>Protected Methods</h2></td></tr><tr><td nowrap align=right valign=top>virtual <a class="el" href="classTiXmlNode.html">TiXmlNode</a> *&nbsp;</td><td valign=bottom><a class="el" href="classTiXmlDocument.html#b1">Clone</a> () const</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Create an exact duplicate of this node and return it.</em> <a href="#b1"></a><em></em></font><br><br></td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2>Always the top level node.<p>A 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. <p><hr><h2>Member Function Documentation</h2><a name="a21" doxytag="TiXmlDocument::ClearError"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> void TiXmlDocument::ClearError </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap><code> [inline]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>If you have handled the error, it can be reset with this call.<p>The error state is automatically cleared if you Parse a new XML block.     </td>  </tr></table><a name="b1" doxytag="TiXmlDocument::Clone"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> virtual <a class="el" href="classTiXmlNode.html">TiXmlNode</a>* TiXmlDocument::Clone </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap><code> [protected, virtual]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Create an exact duplicate of this node and return it.<p>The memory must be deleted by the caller. <p>Implements <a class="el" href="classTiXmlNode.html#a42">TiXmlNode</a>.    </td>  </tr></table><a name="a14" doxytag="TiXmlDocument::Error"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> bool TiXmlDocument::Error </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap> const<code> [inline]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>If an error occurs, Error will be set to true.<p>Also,<ul><li>The <a class="el" href="classTiXmlDocument.html#a16">ErrorId()</a> will contain the integer identifier of the error (not generally useful)<li>The <a class="el" href="classTiXmlDocument.html#a15">ErrorDesc()</a> method will return the name of the error. (very useful)<li>The <a class="el" href="classTiXmlDocument.html#a17">ErrorRow()</a> and <a class="el" href="classTiXmlDocument.html#a18">ErrorCol()</a> will return the location of the error (if known) </ul>    </td>  </tr></table><a name="a16" doxytag="TiXmlDocument::ErrorId"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> const int TiXmlDocument::ErrorId </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap> const<code> [inline]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Generally, you probably want the error string ( <a class="el" href="classTiXmlDocument.html#a15">ErrorDesc()</a> ).<p>But if you prefer the ErrorId, this function will fetch it.     </td>  </tr></table><a name="a17" doxytag="TiXmlDocument::ErrorRow"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> int TiXmlDocument::ErrorRow </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap><code> [inline]</code></td>        </tr>      </table>    </td>  </tr>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -