XML help

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Fhqwhgads
Posts: 42
Joined: Tue Jun 21, 2005 1:43 am

XML help

Post by Fhqwhgads »

I wrote this function to get a xml file based on a game name...

Code: Select all

void getGameInfo(stringw gamename, IGUIEnvironment &ev){
	stringw file = L"./games/";
	file +=  gamename.c_str();
	file +=  "/";
	file += gamename.c_str(); 
	file += ".xml";
	IXMLReader *xml = device->getFileSystem()->createXMLReader(file.c_str());
	while(xml && xml->read()){
		switch(xml->getNodeType()){
		case EXN_ELEMENT:
			{
			stringw developer = xml->getAttributeValue(L"developer");
			stringw version = xml->getAttributeValue(L"version");

			ev.addMessageBox(gamename.c_str(),L"Developed By: " + developer + " Version: " + version);
		break;
		}
	}
}
But it gives me this error in VC++6
C:\Documents and Settings\rcapote\Desktop\RedeemedArcade\source\RedeemedArcade.cpp(31) : error C2664: 'class irr::io::IIrrXMLReader<unsigned short,class irr::IUnknown> *__thiscall irr::io::IFileSystem::createXMLReader(const char *)' : cannot convert
parameter 1 from 'const unsigned short *' to 'const char *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
C:\Documents and Settings\rcapote\Desktop\RedeemedArcade\source\RedeemedArcade.cpp(39) : error C2677: binary '+' : no global operator defined which takes type 'class irr::core::string<unsigned short>' (or there is no acceptable conversion)
Conquistador
Posts: 340
Joined: Wed Sep 28, 2005 4:38 pm
Location: Canada, Eh!

Post by Conquistador »

createXMLReader doesn't take a wchar_t as a parameter, change the file var to a stringc and you should be good to go.
Royal Hamilton Light Infantry - http://www.rhli.ca
Paris/Port Dover Pipes'n Drums - http://www.parisdover.ca
JRM

Post by JRM »

I am trying to open a zip file that has an XML file inside of it, same name. On the site it says it can open it automatically. How do I accomplish this:
For example when used with the Irrlicht Engine, it directly reads from compressed .zip files.

This is on the xml site.

Thank you.


JRM
JRM

Post by JRM »

Is there more examples/tutorials for the XML portion of Irrlicht?


Thank you,

JRM
jrm
Posts: 111
Joined: Tue Dec 13, 2005 8:57 pm

Post by jrm »

Does anyone know how to do this? I have an XML file inside a zipped up file. I think the zip stuff is working fine. but how do I call the XML stuff?

Code: Select all

    if (device.getFileSystem()->addZipFileArchive(MapPath.c_str()))
    {
        //chop of the extention .gz
        MapPath = MapPath.subString(MapPath.findLast('/')+1,MapPath.size()- 3);
        //IrrlichtDevice &device
        io::IXMLReader* xml = device.getFileSystem()->createXMLReader(MapPath.c_str());
    }
Or is there a better way to open and read a zipped xml file?

thank you

JRM
Post Reply