Reputation: 1160
I found pugixml on the internet, and it is quite a nice library, especially for it's format (just a header/source combo, no dll dependencies). My problem is that, I made a format for my engine, but I cannot get all the xml nodes, just the first three, then the whole fun stops. My xml looks like this
<Model>
<Actor childcount="394" meshcount="0" name="sponza.obj">
<Transform 00="1" 01="0" 02="-0" 03="0" 10="0" 11="1" 12="-0" 13="0" 20="-0" 21="-0" 22="1" 23="-0" 30="0" 31="0" 32="-0" 33="1" />
<Actor childcount="0" meshcount="1" name="sponza_00">
<Mesh name="sponza_00-0.mesh" />
<Transform 00="1" 01="0" 02="-0" 03="0" 10="0" 11="1" 12="-0" 13="0" 20="-0" 21="-0" 22="1" 23="-0" 30="0" 31="0" 32="-0" 33="1" />
</Actor>
<Actor childcount="0" meshcount="1" name="sponza_01">
<Mesh name="sponza_01-0.mesh" />
<Transform 00="1" 01="0" 02="-0" 03="0" 10="0" 11="1" 12="-0" 13="0" 20="-0" 21="-0" 22="1" 23="-0" 30="0" 31="0" 32="-0" 33="1" />
</Actor>
<Actor childcount="0" meshcount="1" name="defaultobject">
<Mesh name="defaultobject-0.mesh" />
<Transform 00="1" 01="0" 02="-0" 03="0" 10="0" 11="1" 12="-0" 13="0" 20="-0" 21="-0" 22="1" 23="-0" 30="0" 31="0" 32="-0" 33="1" />
</Actor>
<Actor childcount="0" meshcount="1" name="sponza_03">
<Mesh name="sponza_03-0.mesh" />
<Transform 00="1" 01="0" 02="-0" 03="0" 10="0" 11="1" 12="-0" 13="0" 20="-0" 21="-0" 22="1" 23="-0" 30="0" 31="0" 32="-0" 33="1" />
</Actor>
</Actor>
</Model>
I'm using the sample tree walker
struct simple_walker : pugi::xml_tree_walker
{
virtual bool for_each(pugi::xml_node& node)
{
for (int i = 0; i < depth(); ++i) std::cout << " "; // indentation
std::cout << "- name='" << node.name() << "'\n";
return true; // continue traversal
}
};
but the application writes just this
- name='Model'
- name='Actor'
- name='Transform'
even when there are clearly more tags in the xml document.
Upvotes: 0
Views: 376
Reputation: 52365
The problem is that the XML is not well-formed.
Attribute names cannot start with a number, i.e. 00="1"
is not valid XML.
Upvotes: 4