I set up a test using the following parameters, and it seems to do nothing.
XML(IRR) File:
Code: Select all
<?xml version="1.0">
<attributes name="Method One">
<method attributes="Method Two">
<attributes>
<attributes name="Method One">
<method attributes="Method Two">
<test name="Method Three">
Method Four
</attributes>
<userData>
<attributes>
<bool name="Collider" value="false" />
<bool name="Collidee" value="true" />
</attributes>
</userData>
Code: Select all
io::IAttributes* readXML(IrrlichtDevice* device, io::path& filename)
{
if (!device)
return 0;
io::IXMLReader* reader = device->getFileSystem()->createXMLReader(filename);
if (!reader)
return 0;
io::IAttributes* attributes = device->getFileSystem()->createEmptyAttributes();
attributes->read(reader, false, L"attributes");
return attributes;
}
Code: Select all
/**< Read the global configuration file */
IrrlichtDevice *device = createDevice(video::EDT_NULL);
if (!device) return 1;
io::IAttributes* globalAttributes = readXML(device, *(new core::stringc("Global.irr")));
if (globalAttributes)
{
device->getLogger()->log(core::stringc(globalAttributes->getAttributeCount()).c_str());
device->getLogger()->log(core::stringc(globalAttributes->existsAttribute("userData")).c_str());
}
Irrlicht Engine version 1.8.0
Microsoft Windows 7 Home Premium Edition Service Pack 1 (Build 7601)
0
0
...
Can someone point me to more documentation for this function or tell me what I have done wrong? Is there an easier way to read xml without having to write my own whole reader? I understand I could use IXMLReader but IAttributes::read() seems easier, if it would work.