title: Get integers and floats from xml
body: <p>I'm using tinyxml2 and I know how to get strings of attributes, but I want to also get integers, floats and booleans too. So, I have this code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;tinyxml2.h&gt;
  using namespace std;
  using namespace tinyxml2;
  
  int main()
  {
      XMLDocument doc;
      doc.LoadFile("sample.xml");
  
      XMLElement *titleElement = doc.FirstChildElement("specimen");
  
      int f = -1;
      if (!titleElement-&gt;QueryIntAttribute("age", &amp;f))
          cerr &lt;&lt; "Unable to get value!" &lt;&lt; endl;
  
      cout &lt;&lt; f &lt;&lt; endl;
  
      return 0;
  }
  </code></pre>
  
  <p>And sample.xml being:</p>
  
  <pre><code>&lt;?xml version=1.0?&gt;
  
  &lt;specimen&gt;
      &lt;animal&gt;
          Dog
      &lt;/animal&gt;
      &lt;age&gt;
          12
      &lt;/age&gt;
  &lt;/specimen&gt;
  </code></pre>
  
  <p>Don't worry, the xml file is just a fake sample, nothing real!</p>
  
  <p>Anyway, I am still not able to get the integer value that's within the attribute 'age'. If this doesn't work, then how should I use tinyxml2 to get ints and floats from an xml document?</p>