mirror of
https://github.com/vgough/encfs.git
synced 2024-11-24 17:03:13 +01:00
57ff0e2fe8
git-subtree-dir: vendor/github.com/leethomason/tinyxml2 git-subtree-split: 02d2764fd794422c6d3c86cebe1c892e5a592d23
82 lines
5.2 KiB
HTML
82 lines
5.2 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
|
<meta name="generator" content="Doxygen 1.8.13"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<title>TinyXML-2: Read attributes and text information.</title>
|
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="jquery.js"></script>
|
|
<script type="text/javascript" src="dynsections.js"></script>
|
|
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="search/searchdata.js"></script>
|
|
<script type="text/javascript" src="search/search.js"></script>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
|
</head>
|
|
<body>
|
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
|
<div id="titlearea">
|
|
<table cellspacing="0" cellpadding="0">
|
|
<tbody>
|
|
<tr style="height: 56px;">
|
|
<td id="projectalign" style="padding-left: 0.5em;">
|
|
<div id="projectname">TinyXML-2
|
|
 <span id="projectnumber">5.0.1</span>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.8.13 -->
|
|
<script type="text/javascript">
|
|
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
|
</script>
|
|
<script type="text/javascript" src="menudata.js"></script>
|
|
<script type="text/javascript" src="menu.js"></script>
|
|
<script type="text/javascript">
|
|
$(function() {
|
|
initMenu('',true,false,'search.php','Search');
|
|
$(document).ready(function() { init_search(); });
|
|
});
|
|
</script>
|
|
<div id="main-nav"></div>
|
|
<!-- window showing the filter options -->
|
|
<div id="MSearchSelectWindow"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
|
</div>
|
|
|
|
<!-- iframe showing the search results (closed by default) -->
|
|
<div id="MSearchResultsWindow">
|
|
<iframe src="javascript:void(0)" frameborder="0"
|
|
name="MSearchResults" id="MSearchResults">
|
|
</iframe>
|
|
</div>
|
|
|
|
</div><!-- top -->
|
|
<div class="header">
|
|
<div class="headertitle">
|
|
<div class="title">Read attributes and text information. </div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<div class="textblock"><p>There are fundamentally 2 ways of writing a key-value pair into an XML file. (Something that's always annoyed me about XML.) Either by using attributes, or by writing the key name into an element and the value into the text node wrapped by the element. Both approaches are illustrated in this example, which shows two ways to encode the value "2" into the key "v":</p>
|
|
<p><div class="fragment"><div class="line"><span class="keywordtype">bool</span> example_4()</div><div class="line">{</div><div class="line"> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span>* xml =</div><div class="line"> <span class="stringliteral">"<information>"</span></div><div class="line"> <span class="stringliteral">" <attributeApproach v='2' />"</span></div><div class="line"> <span class="stringliteral">" <textApproach>"</span></div><div class="line"> <span class="stringliteral">" <v>2</v>"</span></div><div class="line"> <span class="stringliteral">" </textApproach>"</span></div><div class="line"> <span class="stringliteral">"</information>"</span>;</div></div><!-- fragment --></p>
|
|
<p>TinyXML-2 has accessors for both approaches.</p>
|
|
<p>When using an attribute, you navigate to the XMLElement with that attribute and use the QueryIntAttribute() group of methods. (Also QueryFloatAttribute(), etc.)</p>
|
|
<p><div class="fragment"><div class="line"> XMLElement* attributeApproachElement = doc.FirstChildElement()->FirstChildElement( <span class="stringliteral">"attributeApproach"</span> );</div><div class="line"> attributeApproachElement->QueryIntAttribute( <span class="stringliteral">"v"</span>, &v0 );</div></div><!-- fragment --></p>
|
|
<p>When using the text approach, you need to navigate down one more step to the XMLElement that contains the text. Note the extra FirstChildElement( "v" ) in the code below. The value of the text can then be safely queried with the QueryIntText() group of methods. (Also QueryFloatText(), etc.)</p>
|
|
<p><div class="fragment"><div class="line"> XMLElement* textApproachElement = doc.FirstChildElement()->FirstChildElement( <span class="stringliteral">"textApproach"</span> );</div><div class="line"> textApproachElement->FirstChildElement( <span class="stringliteral">"v"</span> )->QueryIntText( &v1 );</div></div><!-- fragment --> </p>
|
|
</div></div><!-- contents -->
|
|
<!-- start footer part -->
|
|
<hr class="footer"/><address class="footer"><small>
|
|
Generated on Sat Jul 15 2017 19:39:36 for TinyXML-2 by  <a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
|
</a> 1.8.13
|
|
</small></address>
|
|
</body>
|
|
</html>
|