XMLWrite Problem

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
Roba
Posts: 1
Joined: Tue Oct 06, 2009 1:21 pm
Contact:

XMLWrite Problem

Post by Roba »

Hi,
my programm write my data in a xml file, but I can't read it with irrXMLReader.
But the strange is, that I can read the xml file with Firefox.

Also the problem can't be by the xml reader because my programm can read files wich I have done with a text editor.
I have Liux Ubuntu 64 bit. I hope you can help me. Sorry for my bad English.

Code: Select all

void loadObjekte()
{
	// create the reader using one of the factory functions
	io::IXMLReader* xml = device->getFileSystem()->createXMLReader("objekte.xml");

        // strings for storing the data we want to get out of the file

	wchar_t wname[MAX_OBJEKTE_STRING];
	wchar_t wmesh[MAX_OBJEKTE_STRING];
	wchar_t wtextur[MAX_OBJEKTE_STRING];

        // parse the file until end reached

        while(xml && xml->read())
        {
        	switch(xml->getNodeType())
                {
                case io::EXN_ELEMENT:
                	{
                        	if (!wcscmp(L"objektSonstige", xml->getNodeName()))
				{
					cout<<"test"<<endl;
                                	wcscpy(wname, xml->getAttributeValue(L"name"));
					wcscpy(wmesh, xml->getAttributeValue(L"mesh"));
					wcscpy(wtextur, xml->getAttributeValue(L"textur"));
					
					cSonstige.addEntry(wname,wmesh,wtextur);
				}
                                //else
                                //if (!strcmp("messageText", xml->getNodeName()))
				//{
                                	//caption = xml->getAttributeValue("caption");
				//}
                         }
                         break;
                }
	}

        // delete the xml parser after usage
        delete xml;
}

Code: Select all

void saveObjekte()
{
	// create the writer using one of the factory functions
        io::IXMLWriter * xml = device->getFileSystem()->createXMLWriter("objekte.xml"); 


        // strings for storing the data we want to get out of the file

	wchar_t wname[MAX_OBJEKTE_STRING];
	wchar_t wmesh[MAX_OBJEKTE_STRING];
	wchar_t wtextur[MAX_OBJEKTE_STRING];

	//write the Header
	xml->writeXMLHeader();

	//write <objekte>
	//xml->writeElement("objekte", false);
	xml->writeComment(L"Objekte Sonstige");

	//objektesonstige include
	cSonstige.setPointerStart();
	for(int i=0;i<cSonstige.getMaxEntry();i++);
	{
		cSonstige.getNextEntry(wname,wmesh,wtextur);

		xml->writeElement(L"objektSonstige", true, L"name", wname, L"mesh", wmesh, L"textur", wtextur);
	}


	//schreiben von </objekte>
	//xml->writeClosingTag("objekte");

        // delete the xml parser after usage
        delete xml;
}
Roba
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Post Reply