title: Errors with returning datatypes other than char* from XML-file using C++
body: <p>It's my first time using XML and I am currently trying to return an integer (actually want to return a double but haven't got that far yet) from an XML-file using C++. I'm using RAPIDXML and the following implementation:</p>
  
  <p>All files are in the same directory.</p>
  
  <p>XML (firstxml.xml):</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xsi:noNamespaceSchemaLocation="firstxsd.xsd"&gt;
      &lt;A&gt;10&lt;/A&gt;
      &lt;B&gt;Hello&lt;/B&gt;
  &lt;/test&gt;
  </code></pre>
  
  <p>XML-Schema (firstxsd.xsd):</p>
  
  <pre><code>&lt;xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;
    &lt;xs:element name="test"&gt;
      &lt;xs:complexType&gt;
        &lt;xs:sequence&gt;
          &lt;xs:element type="xs:integer" name="A"/&gt;
          &lt;xs:element type="xs:string" name="B"/&gt;
        &lt;/xs:sequence&gt;
      &lt;/xs:complexType&gt;
    &lt;/xs:element&gt;
  &lt;/xs:schema&gt;
  </code></pre>
  
  <p>C++ (test.cxx):</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;sstream&gt;
  #include &lt;fstream&gt;
  #include "rapidxml-1.13/rapidxml.hpp"
  #include "rapidxml-1.13/rapidxml_print.hpp"
  #include &lt;string&gt;
  #include &lt;stdio.h&gt;
  #include &lt;vector&gt;
  
  int main(int argc, char* argv[])
    {
      std::ifstream file ("firstxml.xml");
        if (file.is_open())
          {
            file.seekg(0,std::ios::end);
            int size = file.tellg();
            file.seekg(0,std::ios::beg);
  
            char* buffer = new char [size];
  
            file.read (buffer, size);
            file.close();
  
            rapidxml::xml_document&lt;&gt; doc;
            doc.parse&lt;0&gt;(buffer);
            rapidxml::xml_node&lt;&gt; *node = doc.first_node()-&gt;first_node();
  
            //Line which results in error
            std::cout &lt;&lt; node-&gt;value()*10 &lt;&lt; std::endl;
  
            delete[] buffer;
          }
    }
  </code></pre>
  
  <p>The error:</p>
  
  <pre><code>test.cxx:52:31: error: invalid operands of types ‘char*’ and ‘int’ to binary ‘operator*’
  </code></pre>
  
  <p>From the tutorials I have read online, I believe I am constructing the files correctly and so the value parsed into the C++ file from the node A should be an integer. One thing I did notice is that in the RAPIDXML manual the specification of value() is as follows:</p>
  
  <pre><code>Ch* value() const;
  
  Description: Gets value of node. Interpretation of value depends on type of node. Note that value will not be zero-terminated if rapidxml::parse_no_string_terminators option was selected during parse. Use value_size() function to determine length of the value.
  
  Returns: Value of node, or empty string if node has no value.
  </code></pre>
  
  <p>So the function definition says it always returns a character pointer, but the line "Interpretation of value depends on type of node" implies it returns a type-dependant value.</p>
  
  <p>Thank you for taking the time to look at my issue, any help is greatly appreciated,</p>
  
  <p>Paul.</p>