I'm building a project on Ubuntu in which I'm using TinyXPath library along with TinyXml to parse the following xml:
<nodes>
<node attribute1="1" attribute2="2" />
<node attribute1="2" attribute2="3" />
...
<node attribute1="10" attribute2="11" />
</nodes>
To find out the number of node entries contained, I'm using:
TinyXPath::i_xpath_int( xml_root,"count(/nodes/node)")
Apparently, using this function call in one object returns the actual number of nodes, 10; but using it in another object (a different class type), it always returns 0. I have checked to see if xml_root is the same object in both cases and both objects have the same address. Printing the contents gave me the same xml.
Instead, if I use TinyXML, I get the right result and I can even access all the atributes and get the right results. The following code gives the right no_nodes:
for(node = xml_root->FirstChild(); node; node = node->NextSibling())
no_nodes++;
Here comes the weird part. If I build this project on Windows 7, it works just fine. The function call always returns the right number of nodes. Has anyone encountered this sort of problem before?
P.S.: I know that I haven't given many specifics on this problem, but it is a huge project and it would take me days to explain it all. So this is just a shot in the dark.