Is it possible to create a IXMLReader from a stringw or such like?
e.g. instead of this
Code: Select all
io::IXMLReader *xml = device->getFileSystem()->createXMLReader(fn);
Code: Select all
io::IXMLReader *xml = device->getFileSystem()->createXMLReader(fn);
Code: Select all
io::IXMLReader *createXMLReaderFromString(stringw fs)
{
irr::u32 c = fs.size();
irr::core::irrAllocator<wchar_t> a;
wchar_t* m = a.allocate(c);
for(irr::u32 i = 0; i < c; i++)
{
m[i] = fs[i];
}
IReadFile* f = device->getFileSystem()->createMemoryReadFile(
m, // buffer
c, // length
"myfile.xml",
true /* this should delete my m on drop */);
return device->getFileSystem()->createXMLReader(f);
}
void xml_test_02()
{
stringw fs = L"<data><entry attr=\"1\" /><enter /></data>";
io::IXMLReader *xml = createXMLReaderFromString(fs);
//io::path fn = "test.xml";
//io::IXMLReader *xml = device->getFileSystem()->createXMLReader(fn);
while(xml && xml->read())
{
std::wcout << "name: " << xml->getNodeName() << std::endl;
}
xml->drop();
}
Code: Select all
irr::core::irrAllocator<irr::fschar_t> a;
irr::fschar_t* m = a.allocate(c);