📄 classtixmlelement.html
字号:
Note that this function can be misleading. If the element foo was created from this XML: <div class="fragment"><pre class="fragment"> <foo><b>This is text</b></foo> </pre></div><p>then the value of str would be null. The first child node isn't a text node, it is another element. From this XML: <div class="fragment"><pre class="fragment"> <foo>This is <b>text</b></foo> </pre></div> <a class="el" href="classTiXmlElement.html#f3282294986cdb216646ea1f67af2c87">GetText()</a> will return "This is ".<p>WARNING: <a class="el" href="classTiXmlElement.html#f3282294986cdb216646ea1f67af2c87">GetText()</a> accesses a child node - don't become confused with the similarly named <a class="el" href="classTiXmlHandle.html#9fc739c8a18d160006f82572fc143d13">TiXmlHandle::Text()</a> and <a class="el" href="classTiXmlNode.html#3ddfbcac78fbea041fad57e5c6d60a03">TiXmlNode::ToText()</a> which are safe type casts on the referenced node. </div></div><p><a class="anchor" name="fbf52736e70fc91ec9d760721d6f4fd2"></a><!-- doxytag: member="TiXmlElement::Print" ref="fbf52736e70fc91ec9d760721d6f4fd2" args="(FILE *cfile, int depth) const " --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">virtual void TiXmlElement::Print </td> <td>(</td> <td class="paramtype">FILE * </td> <td class="paramname"> <em>cfile</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"> <em>depth</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td width="100%"> const<code> [virtual]</code></td> </tr> </table></div><div class="memdoc"><p>All TinyXml classes can print themselves to a filestream or the string class (TiXmlString in non-STL mode, std::string in STL mode. <p>) Either or both cfile and str can be null.<p>This is a formatted print, and will insert tabs and newlines.<p>(For an unformatted stream, use the << operator.) <p>Implements <a class="el" href="classTiXmlBase.html#0de56b3f2ef14c65091a3b916437b512">TiXmlBase</a>.</div></div><p><a class="anchor" name="ea0bfe471380f281c5945770ddbf52b9"></a><!-- doxytag: member="TiXmlElement::QueryIntAttribute" ref="ea0bfe471380f281c5945770ddbf52b9" args="(const char *name, int *_value) const " --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">int TiXmlElement::QueryIntAttribute </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"> <em>name</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int * </td> <td class="paramname"> <em>_value</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td width="100%"> const</td> </tr> </table></div><div class="memdoc"><p>QueryIntAttribute examines the attribute - it is an alternative to the <a class="el" href="classTiXmlElement.html#e419a442a9701a62b0c3d8fd1cbdd12d">Attribute()</a> method with richer error checking. <p>If the attribute is an integer, it is stored in 'value' and the call returns TIXML_SUCCESS. If it is not an integer, it returns TIXML_WRONG_TYPE. If the attribute does not exist, then TIXML_NO_ATTRIBUTE is returned. </div></div><p><a class="anchor" name="e3b9a03b0a56663a40801c7256683576"></a><!-- doxytag: member="TiXmlElement::QueryValueAttribute" ref="e3b9a03b0a56663a40801c7256683576" args="(const std::string &name, T *outValue) const " --><div class="memitem"><div class="memproto"><div class="memtemplate">template<typename T> </div> <table class="memname"> <tr> <td class="memname">int TiXmlElement::QueryValueAttribute </td> <td>(</td> <td class="paramtype">const std::string & </td> <td class="paramname"> <em>name</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">T * </td> <td class="paramname"> <em>outValue</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td width="100%"> const<code> [inline]</code></td> </tr> </table></div><div class="memdoc"><p>Template form of the attribute query which will try to read the attribute into the specified type. <p>Very easy, very powerful, but be careful to make sure to call this with the correct type.<p>NOTE: This method doesn't work correctly for 'string' types.<p><dl compact><dt><b>Returns:</b></dt><dd>TIXML_SUCCESS, TIXML_WRONG_TYPE, or TIXML_NO_ATTRIBUTE </dd></dl></div></div><p><a class="anchor" name="ce6f4be75e373726d4774073d666d1a7"></a><!-- doxytag: member="TiXmlElement::SetAttribute" ref="ce6f4be75e373726d4774073d666d1a7" args="(const char *name, int value)" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">void TiXmlElement::SetAttribute </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"> <em>name</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"> <em>value</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td width="100%"></td> </tr> </table></div><div class="memdoc"><p>Sets an attribute of name to a given value. <p>The attribute will be created if it does not exist, or changed if it does. </div></div><p><a class="anchor" name="bf0b3bd7f0e4c746a89ec6e7f101fc32"></a><!-- doxytag: member="TiXmlElement::SetAttribute" ref="bf0b3bd7f0e4c746a89ec6e7f101fc32" args="(const char *name, const char *_value)" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">void TiXmlElement::SetAttribute </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"> <em>name</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char * </td> <td class="paramname"> <em>_value</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td width="100%"></td> </tr> </table></div><div class="memdoc"><p>Sets an attribute of name to a given value. <p>The attribute will be created if it does not exist, or changed if it does. </div></div><p><a class="anchor" name="0d1dd975d75496778177e35abfe0ec0b"></a><!-- doxytag: member="TiXmlElement::SetDoubleAttribute" ref="0d1dd975d75496778177e35abfe0ec0b" args="(const char *name, double value)" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">void TiXmlElement::SetDoubleAttribute </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"> <em>name</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">double </td> <td class="paramname"> <em>value</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td width="100%"></td> </tr> </table></div><div class="memdoc"><p>Sets an attribute of name to a given value. <p>The attribute will be created if it does not exist, or changed if it does. </div></div><p><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 May 6 15:41:23 2007 for TinyXml by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -