Suzie999 245 Coding Hobbyist

(edit) this is solved, was a unicode issue.

Hi
I'm hoping someone has used the library pugixml
I'm just trying to use a simple example provided but I'm not getting the result I expect.

int _tmain(int argc, _TCHAR* argv[])
{
    pugi::xml_document doc;
    pugi::xml_parse_result result = doc.load_file("tree.xml");
    //pugi::char_t * c = "Fail\0"; // used with as_string() method
    std::cout 
        << "Load result: " << result.description() // output = "Load result: No Error "
        << ", mesh name: " << doc.child("mesh").attribute("name").value() // output = ", mesh name: "
        << std::endl;
    return 0;
}

I was expecting
"Load result: No Error, mesh name: mesh_root"

But instead the attribute name is not showing, well the default is showing which is an empty string "".
"Load result: No Error, mesh name: "

Here is the xml doc

<?xml version="1.0"?>
<mesh name="mesh_root">
    <!-- here is a mesh node -->
    some text
    <![CDATA[someothertext]]>
    some more text
    <node attr1="value1" attr2="value2" />
    <node attr1="value2">
        <innernode/>
    </node>
</mesh>
<?include somedata?>

It seems such a simple code, and is the most basic I could find.
I'd sure appreciate any help at all.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.