For an XML that has
<?xml version="1.0" encoding="utf-8"?>
<COLLADA version="1.4.0" xmlns="http://www.collada.org/2005/11/COLLADASchema">
<library_geometries>
<geometry id="Cube">
<mesh>
<source id="Cube">
<float_array count="24" ">1 2 3</float_array>
[..]
I’m getting properly “1 2 3” string with a
if (!xmlStrcmp(cur_node->name, (const xmlChar *) "mesh")
printf(": %s\n",xmlNodeGetContent(cur_node->children->next);
But how do I get the value of ‘count’? (“count=”24″”)
e.g.
printf(": %s\n", xmlGetProp(cur_node->children->next,(const xmlChar *)"count"));
isn’t right.
The definition of
xmlNodeGetContentisThus what’s happening is that
cur_node->children->nextactually points at the<source>node, not the<float_array...node. The call toxmlNodeGetContentappears to work because it’s fetching the content from the contained node.The call to
xmlGetPropreturns nothing because you’re invoking it on the wrong node.You need to ensure that you are invoking
xmlGetPropon the correct node.