📄 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#a27">GetText()</a> will return "This is ".<p>
WARNING: <a class="el" href="classTiXmlElement.html#a27">GetText()</a> accesses a child node - don't become confused with the similarly named <a class="el" href="classTiXmlHandle.html#a17">TiXmlHandle::Text()</a> and <a class="el" href="classTiXmlNode.html#a70">TiXmlNode::ToText()</a> which are safe type casts on the referenced node. </td>
</tr>
</table>
<a class="anchor" name="a29"></a><!-- doxytag: member="TiXmlElement::Print" ref="a29" args="(FILE *cfile, int depth) 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">virtual void TiXmlElement::Print </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">FILE * </td>
<td class="mdname" nowrap> <em>cfile</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>int </td>
<td class="mdname" nowrap> <em>depth</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">) </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>
</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 << operator.)
<p>
Implements <a class="el" href="classTiXmlBase.html#a2">TiXmlBase</a>. </td>
</tr>
</table>
<a class="anchor" name="a8"></a><!-- doxytag: member="TiXmlElement::QueryIntAttribute" ref="a8" args="(const char *name, int *_value) 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">int TiXmlElement::QueryIntAttribute </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const char * </td>
<td class="mdname" nowrap> <em>name</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>int * </td>
<td class="mdname" nowrap> <em>_value</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">) </td>
<td class="md" colspan="2"> const</td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
QueryIntAttribute examines the attribute - it is an alternative to the <a class="el" href="classTiXmlElement.html#a5">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. </td>
</tr>
</table>
<a class="anchor" name="a19"></a><!-- doxytag: member="TiXmlElement::SetAttribute" ref="a19" args="(const char *name, int value)" --><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 TiXmlElement::SetAttribute </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const char * </td>
<td class="mdname" nowrap> <em>name</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>int </td>
<td class="mdname" nowrap> <em>value</em></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>
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. </td>
</tr>
</table>
<a class="anchor" name="a11"></a><!-- doxytag: member="TiXmlElement::SetAttribute" ref="a11" args="(const char *name, const char *_value)" --><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 TiXmlElement::SetAttribute </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const char * </td>
<td class="mdname" nowrap> <em>name</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>const char * </td>
<td class="mdname" nowrap> <em>_value</em></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>
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. </td>
</tr>
</table>
<a class="anchor" name="a20"></a><!-- doxytag: member="TiXmlElement::SetDoubleAttribute" ref="a20" args="(const char *name, double value)" --><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 TiXmlElement::SetDoubleAttribute </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const char * </td>
<td class="mdname" nowrap> <em>name</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>double </td>
<td class="mdname" nowrap> <em>value</em></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>
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. </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 + -