summaryrefslogtreecommitdiff
path: root/zenxml/doc/classzen_1_1_xml_in.html
blob: f1093061112163bdf841cf1883042628aab4c36a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
<!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"/>
<title>zen::Xml: zen::XmlIn Class Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  <td id="projectlogo"><img alt="Logo" src="zenXml.png"/></td>
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">zen::Xml
   
   </div>
   <div id="projectbrief">Simple C++  XML Processing</div>
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.8.0 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a></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 id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="namespacezen.html">zen</a>      </li>
      <li class="navelem"><a class="el" href="classzen_1_1_xml_in.html">XmlIn</a>      </li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a>  </div>
  <div class="headertitle">
<div class="title">zen::XmlIn Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Proxy class to conveniently convert XML structure to user data.  
 <a href="classzen_1_1_xml_in.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="bind_8h_source.html">bind.h</a>&gt;</code></p>

<p><a href="classzen_1_1_xml_in-members.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a5b48c9848e6c631a04cec2477ff85c0f"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classzen_1_1_xml_in.html#a5b48c9848e6c631a04cec2477ff85c0f">XmlIn</a> (const <a class="el" href="classzen_1_1_xml_doc.html">XmlDoc</a> &amp;doc)</td></tr>
<tr class="memdesc:a5b48c9848e6c631a04cec2477ff85c0f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Construct an input proxy for an XML document.  <a href="#a5b48c9848e6c631a04cec2477ff85c0f"></a><br/></td></tr>
<tr class="memitem:ae072660cde71fd4695c04d074098b430"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classzen_1_1_xml_in.html#ae072660cde71fd4695c04d074098b430">XmlIn</a> (const <a class="el" href="classzen_1_1_xml_element.html">XmlElement</a> *element)</td></tr>
<tr class="memdesc:ae072660cde71fd4695c04d074098b430"><td class="mdescLeft">&#160;</td><td class="mdescRight">Construct an input proxy for a single XML element, may be nullptr.  <a href="#ae072660cde71fd4695c04d074098b430"></a><br/></td></tr>
<tr class="memitem:a33de75412df69cb25e0fd8b3bc70c9f8"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classzen_1_1_xml_in.html#a33de75412df69cb25e0fd8b3bc70c9f8">XmlIn</a> (const <a class="el" href="classzen_1_1_xml_element.html">XmlElement</a> &amp;element)</td></tr>
<tr class="memdesc:a33de75412df69cb25e0fd8b3bc70c9f8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Construct an input proxy for a single XML element.  <a href="#a33de75412df69cb25e0fd8b3bc70c9f8"></a><br/></td></tr>
<tr class="memitem:a9b38167835a28eac9a2297f35f51e53d"><td class="memTemplParams" colspan="2">template&lt;class String &gt; </td></tr>
<tr class="memitem:a9b38167835a28eac9a2297f35f51e53d"><td class="memTemplItemLeft" align="right" valign="top"><a class="el" href="classzen_1_1_xml_in.html">XmlIn</a>&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classzen_1_1_xml_in.html#a9b38167835a28eac9a2297f35f51e53d">operator[]</a> (const String &amp;name) const </td></tr>
<tr class="memdesc:a9b38167835a28eac9a2297f35f51e53d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Retrieve a handle to an XML child element for reading.  <a href="#a9b38167835a28eac9a2297f35f51e53d"></a><br/></td></tr>
<tr class="memitem:a60cf2678c989621545d27745dcafa4a4"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classzen_1_1_xml_in.html#a60cf2678c989621545d27745dcafa4a4">next</a> ()</td></tr>
<tr class="memdesc:a60cf2678c989621545d27745dcafa4a4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Refer to next sibling element with the same name.  <a href="#a60cf2678c989621545d27745dcafa4a4"></a><br/></td></tr>
<tr class="memitem:a98cc59f687c89549381e76105f8fb506"><td class="memTemplParams" colspan="2">template&lt;class T &gt; </td></tr>
<tr class="memitem:a98cc59f687c89549381e76105f8fb506"><td class="memTemplItemLeft" align="right" valign="top">bool&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classzen_1_1_xml_in.html#a98cc59f687c89549381e76105f8fb506">operator()</a> (T &amp;value) const </td></tr>
<tr class="memdesc:a98cc59f687c89549381e76105f8fb506"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read user data from the underlying XML element.  <a href="#a98cc59f687c89549381e76105f8fb506"></a><br/></td></tr>
<tr class="memitem:a971cd7054c551c4460d5220f6ec5cf01"><td class="memTemplParams" colspan="2">template&lt;class String , class T &gt; </td></tr>
<tr class="memitem:a971cd7054c551c4460d5220f6ec5cf01"><td class="memTemplItemLeft" align="right" valign="top">bool&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classzen_1_1_xml_in.html#a971cd7054c551c4460d5220f6ec5cf01">attribute</a> (const String &amp;name, T &amp;value) const </td></tr>
<tr class="memdesc:a971cd7054c551c4460d5220f6ec5cf01"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read user data from an XML attribute.  <a href="#a971cd7054c551c4460d5220f6ec5cf01"></a><br/></td></tr>
<tr class="memitem:a647b468b7c6c95b25f2e43627184177f"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a647b468b7c6c95b25f2e43627184177f"></a>
const <a class="el" href="classzen_1_1_xml_element.html">XmlElement</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classzen_1_1_xml_in.html#a647b468b7c6c95b25f2e43627184177f">get</a> () const </td></tr>
<tr class="memdesc:a647b468b7c6c95b25f2e43627184177f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return a pointer to the underlying Xml element, may be nullptr. <br/></td></tr>
<tr class="memitem:a954950849b52557369932ab2a8b4ad72"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classzen_1_1_xml_in.html#a954950849b52557369932ab2a8b4ad72">operator int ConversionToBool::*</a> () const </td></tr>
<tr class="memdesc:a954950849b52557369932ab2a8b4ad72"><td class="mdescLeft">&#160;</td><td class="mdescRight">Test whether the underlying XML element exists.  <a href="#a954950849b52557369932ab2a8b4ad72"></a><br/></td></tr>
<tr class="memitem:a33b5dd504d3165aa3f923f6b33e9991a"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classzen_1_1_xml_in.html#a33b5dd504d3165aa3f923f6b33e9991a">errorsOccured</a> () const </td></tr>
<tr class="memdesc:a33b5dd504d3165aa3f923f6b33e9991a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Notifies errors while mapping the XML to user data.  <a href="#a33b5dd504d3165aa3f923f6b33e9991a"></a><br/></td></tr>
<tr class="memitem:a84bb497d3b3fc753d054e52c4823c05e"><td class="memTemplParams" colspan="2">template&lt;class String &gt; </td></tr>
<tr class="memitem:a84bb497d3b3fc753d054e52c4823c05e"><td class="memTemplItemLeft" align="right" valign="top">std::vector&lt; String &gt;&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classzen_1_1_xml_in.html#a84bb497d3b3fc753d054e52c4823c05e">getErrorsAs</a> () const </td></tr>
<tr class="memdesc:a84bb497d3b3fc753d054e52c4823c05e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get a list of XML element and attribute names which failed to convert to user data.  <a href="#a84bb497d3b3fc753d054e52c4823c05e"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Proxy class to conveniently convert XML structure to user data. </p>
</div><hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a5b48c9848e6c631a04cec2477ff85c0f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classzen_1_1_xml_in.html#a5b48c9848e6c631a04cec2477ff85c0f">zen::XmlIn::XmlIn</a> </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classzen_1_1_xml_doc.html">XmlDoc</a> &amp;&#160;</td>
          <td class="paramname"><em>doc</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Construct an input proxy for an XML document. </p>
<div class="fragment"><pre class="fragment">        <a class="code" href="classzen_1_1_xml_doc.html" title="The complete XML document.">zen::XmlDoc</a> doc;
          ... <span class="comment">//load document</span>
        <a class="code" href="classzen_1_1_xml_in.html" title="Proxy class to conveniently convert XML structure to user data.">zen::XmlIn</a> in(doc);
        in[<span class="stringliteral">&quot;elem1&quot;</span>](value1); <span class="comment">//</span>
        in[<span class="stringliteral">&quot;elem2&quot;</span>](value2); <span class="comment">//read data from XML elements into variables &quot;value1&quot;, &quot;value2&quot;, &quot;value3&quot;</span>
        in[<span class="stringliteral">&quot;elem3&quot;</span>](value3); <span class="comment">//</span>
</pre></div> 
</div>
</div>
<a class="anchor" id="ae072660cde71fd4695c04d074098b430"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classzen_1_1_xml_in.html#a5b48c9848e6c631a04cec2477ff85c0f">zen::XmlIn::XmlIn</a> </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classzen_1_1_xml_element.html">XmlElement</a> *&#160;</td>
          <td class="paramname"><em>element</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Construct an input proxy for a single XML element, may be nullptr. </p>
<dl class="section see"><dt>See also:</dt><dd><a class="el" href="classzen_1_1_xml_in.html#a5b48c9848e6c631a04cec2477ff85c0f" title="Construct an input proxy for an XML document.">XmlIn(const XmlDoc&amp; doc)</a> </dd></dl>

</div>
</div>
<a class="anchor" id="a33de75412df69cb25e0fd8b3bc70c9f8"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classzen_1_1_xml_in.html#a5b48c9848e6c631a04cec2477ff85c0f">zen::XmlIn::XmlIn</a> </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classzen_1_1_xml_element.html">XmlElement</a> &amp;&#160;</td>
          <td class="paramname"><em>element</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Construct an input proxy for a single XML element. </p>
<dl class="section see"><dt>See also:</dt><dd><a class="el" href="classzen_1_1_xml_in.html#a5b48c9848e6c631a04cec2477ff85c0f" title="Construct an input proxy for an XML document.">XmlIn(const XmlDoc&amp; doc)</a> </dd></dl>

</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a971cd7054c551c4460d5220f6ec5cf01"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class String , class T &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">bool <a class="el" href="classzen_1_1_xml_in.html#a971cd7054c551c4460d5220f6ec5cf01">zen::XmlIn::attribute</a> </td>
          <td>(</td>
          <td class="paramtype">const String &amp;&#160;</td>
          <td class="paramname"><em>name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">T &amp;&#160;</td>
          <td class="paramname"><em>value</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Read user data from an XML attribute. </p>
<p>This conversion requires a specialization of <a class="el" href="namespacezen.html#acaf85ab94b61882f957afcd355386bff" title="Convert text to user data - used by XML elements and attributes.">zen::readText()</a> for type T.</p>
<div class="fragment"><pre class="fragment">        <a class="code" href="classzen_1_1_xml_doc.html" title="The complete XML document.">zen::XmlDoc</a> doc;
          ... <span class="comment">//load document</span>
        <a class="code" href="classzen_1_1_xml_in.html" title="Proxy class to conveniently convert XML structure to user data.">zen::XmlIn</a> in(doc);
        in[<span class="stringliteral">&quot;elem&quot;</span>].attribute(<span class="stringliteral">&quot;attr1&quot;</span>, value1); <span class="comment">//</span>
        in[<span class="stringliteral">&quot;elem&quot;</span>].attribute(<span class="stringliteral">&quot;attr2&quot;</span>, value2); <span class="comment">//read data from XML attributes into variables &quot;value1&quot;, &quot;value2&quot;, &quot;value3&quot;</span>
        in[<span class="stringliteral">&quot;elem&quot;</span>].attribute(<span class="stringliteral">&quot;attr3&quot;</span>, value3); <span class="comment">//</span>
</pre></div><dl class=""><dt><b>Template Parameters:</b></dt><dd>
  <table class="">
    <tr><td class="paramname">String</td><td>Arbitrary string-like type: e.g. std::string, wchar_t*, char[], wchar_t, wxString, MyStringClass, ... </td></tr>
    <tr><td class="paramname">T</td><td>String-convertible user data type: e.g. any string-like type, all built-in arithmetic numbers </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns:</dt><dd>"true" if the attribute was found and the conversion to the output value was successful. </dd></dl>
<dl class="section see"><dt>See also:</dt><dd><a class="el" href="classzen_1_1_xml_element.html#af90ac6f435b03ba37cf47ee188c58887" title="Retrieve an attribute by name.">XmlElement::getAttribute()</a> </dd></dl>

</div>
</div>
<a class="anchor" id="a33b5dd504d3165aa3f923f6b33e9991a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool <a class="el" href="classzen_1_1_xml_in.html#a33b5dd504d3165aa3f923f6b33e9991a">zen::XmlIn::errorsOccured</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Notifies errors while mapping the XML to user data. </p>
<p>Error logging is shared by each hiearchy of <a class="el" href="classzen_1_1_xml_in.html" title="Proxy class to conveniently convert XML structure to user data.">XmlIn</a> proxy instances that are created from each other. Consequently it doesn't matter which instance you query for errors: </p>
<div class="fragment"><pre class="fragment">        <a class="code" href="classzen_1_1_xml_in.html#a5b48c9848e6c631a04cec2477ff85c0f" title="Construct an input proxy for an XML document.">XmlIn</a> in(doc);
        <a class="code" href="classzen_1_1_xml_in.html#a5b48c9848e6c631a04cec2477ff85c0f" title="Construct an input proxy for an XML document.">XmlIn</a> inItem = in[<span class="stringliteral">&quot;item1&quot;</span>];

        <span class="keywordtype">int</span> value = 0;
        inItem(value); <span class="comment">//let&#39;s assume this conversion failed</span>

        assert(in.errorsOccured() == inItem.errorsOccured());
        assert(in.getErrorsAs&lt;std::string&gt;() == inItem.getErrorsAs&lt;std::string&gt;());
</pre></div><p>Note that error logging is <b>NOT</b> global, but owned by all instances of a hierarchy of <a class="el" href="classzen_1_1_xml_in.html" title="Proxy class to conveniently convert XML structure to user data.">XmlIn</a> proxies. Therefore it's safe to use unrelated <a class="el" href="classzen_1_1_xml_in.html" title="Proxy class to conveniently convert XML structure to user data.">XmlIn</a> proxies in multiple threads. <br/>
<br/>
 However be aware that the chain of connected proxy instances will be broken once you call <a class="el" href="classzen_1_1_xml_in.html#a647b468b7c6c95b25f2e43627184177f" title="Return a pointer to the underlying Xml element, may be nullptr.">XmlIn::get()</a> to retrieve the underlying pointer. Errors that occur when working with this pointer are not logged by the original set of related instances. </p>

</div>
</div>
<a class="anchor" id="a84bb497d3b3fc753d054e52c4823c05e"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class String &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">std::vector&lt;String&gt; <a class="el" href="classzen_1_1_xml_in.html#a84bb497d3b3fc753d054e52c4823c05e">zen::XmlIn::getErrorsAs</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Get a list of XML element and attribute names which failed to convert to user data. </p>
<dl class=""><dt><b>Template Parameters:</b></dt><dd>
  <table class="">
    <tr><td class="paramname">String</td><td>Arbitrary string class: e.g. std::string, std::wstring, wxString, MyStringClass, ... </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns:</dt><dd>A list of XML element and attribute names, empty list if no errors occured. </dd></dl>

</div>
</div>
<a class="anchor" id="a60cf2678c989621545d27745dcafa4a4"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classzen_1_1_xml_in.html#a60cf2678c989621545d27745dcafa4a4">zen::XmlIn::next</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Refer to next sibling element with the same name. </p>
<p><b>Example:</b> Loop over all XML child elements named "Item" </p>
<div class="fragment"><pre class="fragment">    &lt;?xml version="1.0" encoding="UTF-8"?&gt;
    &lt;Root&gt;
        &lt;Item&gt;1&lt;/Item&gt;
        &lt;Item&gt;3&lt;/Item&gt;
        &lt;Item&gt;5&lt;/Item&gt;
    &lt;/Root&gt;</pre></div><div class="fragment"><pre class="fragment">    <a class="code" href="classzen_1_1_xml_in.html" title="Proxy class to conveniently convert XML structure to user data.">zen::XmlIn</a> in(doc);
    ...
    <span class="keywordflow">for</span> (<a class="code" href="classzen_1_1_xml_in.html" title="Proxy class to conveniently convert XML structure to user data.">zen::XmlIn</a> child = in[<span class="stringliteral">&quot;Item&quot;</span>]; child; child.<a class="code" href="classzen_1_1_xml_in.html#a60cf2678c989621545d27745dcafa4a4" title="Refer to next sibling element with the same name.">next</a>())
    {
        ...
    }
</pre></div> 
</div>
</div>
<a class="anchor" id="a954950849b52557369932ab2a8b4ad72"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">zen::XmlIn::operator int ConversionToBool::* </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Test whether the underlying XML element exists. </p>
<div class="fragment"><pre class="fragment">         <a class="code" href="classzen_1_1_xml_in.html#a5b48c9848e6c631a04cec2477ff85c0f" title="Construct an input proxy for an XML document.">XmlIn</a> in(doc);
         <a class="code" href="classzen_1_1_xml_in.html#a5b48c9848e6c631a04cec2477ff85c0f" title="Construct an input proxy for an XML document.">XmlIn</a> child = in[<span class="stringliteral">&quot;elem1&quot;</span>];
         <span class="keywordflow">if</span> (child)
           ...
</pre></div><p> Use member pointer as implicit conversion to bool (C++ Templates - Vandevoorde/Josuttis; chapter 20) </p>

</div>
</div>
<a class="anchor" id="a98cc59f687c89549381e76105f8fb506"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class T &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">bool zen::XmlIn::operator() </td>
          <td>(</td>
          <td class="paramtype">T &amp;&#160;</td>
          <td class="paramname"><em>value</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Read user data from the underlying XML element. </p>
<p>This conversion requires a specialization of <a class="el" href="namespacezen.html#acaf85ab94b61882f957afcd355386bff" title="Convert text to user data - used by XML elements and attributes.">zen::readText()</a> or <a class="el" href="namespacezen.html#a2bdcecfe7435ef11cedbce47d4e72ee1" title="Convert XML element to structured user data.">zen::readStruc()</a> for type T. </p>
<dl class=""><dt><b>Template Parameters:</b></dt><dd>
  <table class="">
    <tr><td class="paramname">T</td><td>User type that receives the data </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns:</dt><dd>"true" if data was read successfully </dd></dl>

</div>
</div>
<a class="anchor" id="a9b38167835a28eac9a2297f35f51e53d"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class String &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classzen_1_1_xml_in.html">XmlIn</a> zen::XmlIn::operator[] </td>
          <td>(</td>
          <td class="paramtype">const String &amp;&#160;</td>
          <td class="paramname"><em>name</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Retrieve a handle to an XML child element for reading. </p>
<p>It is <b>not</b> an error if the child element does not exist, but only later if a conversion to user data is attempted. </p>
<dl class=""><dt><b>Template Parameters:</b></dt><dd>
  <table class="">
    <tr><td class="paramname">String</td><td>Arbitrary string-like type: e.g. std::string, wchar_t*, char[], wchar_t, wxString, MyStringClass, ... </td></tr>
  </table>
  </dd>
</dl>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">name</td><td>The name of the child element </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
</div><!-- contents -->


<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>

</body>
</html>
bgstack15