1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2<html xmlns="http://www.w3.org/1999/xhtml"> 3<head> 4<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> 5<meta http-equiv="X-UA-Compatible" content="IE=9"/> 6<meta name="generator" content="Doxygen 1.8.13"/> 7<meta name="viewport" content="width=device-width, initial-scale=1"/> 8<title>TinyXML-2: Parse an XML from char buffer</title> 9<link href="tabs.css" rel="stylesheet" type="text/css"/> 10<script type="text/javascript" src="jquery.js"></script> 11<script type="text/javascript" src="dynsections.js"></script> 12<link href="search/search.css" rel="stylesheet" type="text/css"/> 13<script type="text/javascript" src="search/searchdata.js"></script> 14<script type="text/javascript" src="search/search.js"></script> 15<link href="doxygen.css" rel="stylesheet" type="text/css" /> 16</head> 17<body> 18<div id="top"><!-- do not remove this div, it is closed by doxygen! --> 19<div id="titlearea"> 20<table cellspacing="0" cellpadding="0"> 21 <tbody> 22 <tr style="height: 56px;"> 23 <td id="projectalign" style="padding-left: 0.5em;"> 24 <div id="projectname">TinyXML-2 25  <span id="projectnumber">7.0.0</span> 26 </div> 27 </td> 28 </tr> 29 </tbody> 30</table> 31</div> 32<!-- end header part --> 33<!-- Generated by Doxygen 1.8.13 --> 34<script type="text/javascript"> 35var searchBox = new SearchBox("searchBox", "search",false,'Search'); 36</script> 37<script type="text/javascript" src="menudata.js"></script> 38<script type="text/javascript" src="menu.js"></script> 39<script type="text/javascript"> 40$(function() { 41 initMenu('',true,false,'search.php','Search'); 42 $(document).ready(function() { init_search(); }); 43}); 44</script> 45<div id="main-nav"></div> 46<!-- window showing the filter options --> 47<div id="MSearchSelectWindow" 48 onmouseover="return searchBox.OnSearchSelectShow()" 49 onmouseout="return searchBox.OnSearchSelectHide()" 50 onkeydown="return searchBox.OnSearchSelectKey(event)"> 51</div> 52 53<!-- iframe showing the search results (closed by default) --> 54<div id="MSearchResultsWindow"> 55<iframe src="javascript:void(0)" frameborder="0" 56 name="MSearchResults" id="MSearchResults"> 57</iframe> 58</div> 59 60</div><!-- top --> 61<div class="header"> 62 <div class="headertitle"> 63<div class="title">Parse an XML from char buffer </div> </div> 64</div><!--header--> 65<div class="contents"> 66<div class="textblock"> Basic XML string parsing. The basic syntax to parse an XML for a char* and check for an error. (ErrorID() will return 0 for no error.) <div class="fragment"><div class="line"><span class="keywordtype">int</span> example_2()</div><div class="line">{</div><div class="line"> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span>* xml = <span class="stringliteral">"<element/>"</span>;</div><div class="line"> XMLDocument doc;</div><div class="line"> doc.Parse( xml );</div><div class="line"></div><div class="line"> <span class="keywordflow">return</span> doc.ErrorID();</div><div class="line">}</div></div><!-- fragment --> </p> 67</div></div><!-- contents --> 68<!-- start footer part --> 69<hr class="footer"/><address class="footer"><small> 70Generated on Tue Nov 6 2018 09:38:26 for TinyXML-2 by  <a href="http://www.doxygen.org/index.html"> 71<img class="footer" src="doxygen.png" alt="doxygen"/> 72</a> 1.8.13 73</small></address> 74</body> 75</html> 76