I'm parsing an XML file which is quite simple:
<?xml version="1.0" encoding="utf-8"?>
<catalog>
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre><price>44.95</price><publish_date>2000-10-01</publish_date>
<description>An in-depth look at creating applications with XML.</description>
</book>
</catalog>
And when I parse it using the default settings, i.e parse<0>(), like so:
ifstream file(xmlFile.c_str(), ifstream::in );
int length;
file.seekg (0, ios::end);
length = (int)file.tellg();
file.seekg (0, ios::beg);
char xmlBuf[ length + 1 ];
file.read( &xmlBuf[0], length );
xmlBuf[length] = '\0';
document.parse<0>(xmlBuf);
All the nodes are in the correct places and have the correct lengths when queried using xml_node.value_size() or xml_node.name_size(), but actually getting the name or value into a string or even just printf(), it returns a lot of stuff like the following:
(........./.(..............-. <titlK.
Has anyone else run into this?