I noticed that XMLReader::run() behaves strangely. After hitting an opening node, calling run() will move the position of the reader to a node without a name, but it'll have the same attribute. Call it again, and it jumps to the next node in the XML file.
main.cpp:
Code: Select all
#include "irrlicht.h"
using namespace irr;
int main()
{
io::IrrXMLReader *xml = io::createIrrXMLReader("test.xml");
for(unsigned short int i = 0; i < 6; i++)
{
xml->read();
printf("Node name: %s, Attribute value: %s\n", xml->getNodeName(), xml->getAttributeValue("name"));
}
system("PAUSE");
}
Code: Select all
<first_node name="fred">
<second_node>
</second_node>
</first_node>
Output:
Code: Select all
Node name: first_node, Attribute value: fred
Node name:
, Attribute value: fred
Node name: second_node, Attribute value: (null)
Node name:
, Attribute value: (null)
Node name: second_node, Attribute value: (null)
Node name: first_node, Attribute value: (null)
Press any key to continue . . .