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

📄 classtixmldocument.html

📁 XML解析器
💻 HTML
字号:
<!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 bgcolor="#ffffff"><!-- Generated by Doxygen 1.2.11.1 --><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.gif" usemap="#TiXmlDocument_map" border="0"></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 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#a4">LoadFile</a> ()</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Load a file using the current document value.</em> <a href="#a4">More...</a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a5" doxytag="TiXmlDocument::SaveFile"></a>bool&nbsp;</td><td valign=bottom><a class="el" href="classTiXmlDocument.html#a5">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="a6" doxytag="TiXmlDocument::LoadFile"></a>bool&nbsp;</td><td valign=bottom><a class="el" href="classTiXmlDocument.html#a6">LoadFile</a> (const char *filename)</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="a7" doxytag="TiXmlDocument::SaveFile"></a>bool&nbsp;</td><td valign=bottom><a class="el" href="classTiXmlDocument.html#a7">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#a8">LoadFile</a> (const std::string &amp;filename)</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 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><a name="a10" doxytag="TiXmlDocument::Parse"></a>virtual const char *&nbsp;</td><td valign=bottom><a class="el" href="classTiXmlDocument.html#a10">Parse</a> (const char *p)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Parse the given null terminated block of xml data.</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#a11">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="#a11">More...</a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a12" doxytag="TiXmlDocument::Error"></a>bool&nbsp;</td><td valign=bottom><a class="el" href="classTiXmlDocument.html#a12">Error</a> () const</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>If, during parsing, a error occurs, Error will be set to true.</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a13" doxytag="TiXmlDocument::ErrorDesc"></a>const char *&nbsp;</td><td valign=bottom><a class="el" href="classTiXmlDocument.html#a13">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#a14">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#a13">ErrorDesc</a>() ).</em> <a href="#a14">More...</a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a15" doxytag="TiXmlDocument::ClearError"></a>void&nbsp;</td><td valign=bottom><a class="el" href="classTiXmlDocument.html#a15">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></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a16" doxytag="TiXmlDocument::Print"></a>void&nbsp;</td><td valign=bottom><a class="el" href="classTiXmlDocument.html#a16">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>virtual void&nbsp;</td><td valign=bottom><a class="el" href="classTiXmlDocument.html#a17">Print</a> (FILE *cfile, int depth=0) const</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>All TinyXml classes can print themselves to a filestream.</em> <a href="#a17">More...</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="a14" 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#a13">ErrorDesc</a>() ).<p>But if you prefer the ErrorId, this function will fetch it.     </td>  </tr></table><a name="a8" doxytag="TiXmlDocument::LoadFile"></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::LoadFile </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">const std::string &amp;&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp; <em>filename</em>          </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><dl compact><dt><b>Parameters: </b><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>filename</em>&nbsp;</td><td>STL std::string version. </td></tr></table></dl>    </td>  </tr></table><a name="a4" doxytag="TiXmlDocument::LoadFile"></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::LoadFile </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></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </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 name="a17" doxytag="TiXmlDocument::Print"></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 void TiXmlDocument::Print </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">FILE *&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>cfile</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>int&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>depth</em> = 0</td>        </tr>        <tr>          <td></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"> const<code> [virtual]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>All TinyXml classes can print themselves to a filestream.<p>This is a formatted print, and will insert tabs and newlines.<p>(For an unformatted stream, use the &lt;&lt; operator.) <p>Reimplemented from <a class="el" href="classTiXmlBase.html#a2">TiXmlBase</a>.    </td>  </tr></table><a name="a11" doxytag="TiXmlDocument::RootElement"></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"> <a class="el" href="classTiXmlElement.html">TiXmlElement</a>* TiXmlDocument::RootElement </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>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><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><address><small>Generated on Fri Apr 11 23:01:21 2003 for TinyXml by<a href="http://www.doxygen.org/index.html"><img src="doxygen.gif" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.11.1 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>, &copy;&nbsp;1997-2001</small></address></body></html>

⌨️ 快捷键说明

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