[SOLVED]pugixml parsing
Hi,
I have an xml file like this-
1 2 3 4 5 6 7 8 9 10
|
<char>
<npc>
<item>
<obj bottle="blood" />
<obj bottle="mana" />
</item>
<name value="John" />
<id value="-1" />
</npc>
</char>
|
And the way I am parsing it-
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
if(result)
{
xml_node char = doc.child("char");
for(xml_node npc = char.first_child(); npc, npc =npc.next_sibling())
{
for(xml_node item = npc.first_child(); item; item = item.next_sibling())
{
xml_node node = item.child("obj");
string v = node.attribute("value").as_string();
print("value: %s\n", v.c_str());
// load name, I'd etc
}
}
}
|
The problem is it is lopping the item but not printing the obj value. Any help would be appreciated.
PS. I typed it from my mobile, so there might be some typing error in the code.
Thanks in advance.
Last edited on
got it :)).
Topic archived. No new replies allowed.