i have a new question about xmlreaderutf16!

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
hzsyber
Posts: 52
Joined: Tue Apr 01, 2008 2:21 pm
Location: Canton,China.

i have a new question about xmlreaderutf16!

Post by hzsyber »

i will read a xml file,file encode is unicode 16le.

i compile have error:

Code: Select all

1>main.cpp
1>e:\code\project\xmltext\main.cpp(33) : error C2664: 'const irr::io::char16 *irr::io::IIrrXMLReader<char_type,super_class>::getAttributeValue(int) const' : cannot convert parameter 1 from 'const char [8]' to 'int'
1>        with
1>        [
1>            char_type=irr::io::char16,
1>            super_class=irr::io::IXMLBase
1>        ]
1>        There is no context in which this conversion is possible
1>e:\code\project\xmltext\main.cpp(42) : error C2228: left of '.c_str' must have class/struct/union
1>        type is 'irr::io::char16'
i try code:

Code: Select all

	IrrXMLReaderUTF16* xml = createIrrXMLReaderUTF16("./temp.xml");
	ETEXT_FORMAT abc;
	abc = xml->getSourceFormat();
	char16 str;
	while(xml && xml->read())
	{
		switch(xml->getNodeType())
		{
		case EXN_ELEMENT:
			{
				if (stringw("Button") == xml->getNodeName())
				{
					str = xml->getAttributeValue("caption");//here. how to get chinese string?
				}
			}
		}
	}
	IGUIStaticText* txtBar;
	dimension2d<int> scrSize = device->getVideoDriver()->getScreenSize();
	rect<int> pos;
	pos = rect<int>(scrSize.Width/2-40, scrSize.Height/2-30, scrSize.Width/2+40, scrSize.Height/2);
	txtBar = device->getGUIEnvironment()->addStaticText(str.c_str(), pos, true, false);
	txtBar->setBackgroundColor(SColor(200,0,0,255));

xml file(use irrxmlwriter create):

Code: Select all

<?xml version="1.0"?>
<config>
<!--comment fro temporary file!-->
	<Button x="中文测试" y="y" w="w" h="h" caption="caption" uid="uid" goto="goto" method="method" oop="oop" />
</config>
Post Reply