Hi,
i've a problem with my xml parser when i want to add text to parse and not only intvalues.
here is my xml file:
<?xml version="1.0"?> <config> <!--This is a config file for the Irrlicht Engine Mesh Viewer.--> <data> <WindowWidth width='1024'/> <WindowHeight height='768'/> <Fullscreen fullscreen='0'/> </data> <messageText starttext="Please select your preferred driver (a) D3D 9.0c (b) D3D 8.1 (c) OpenGL 1.5 other key to exit" </messageText> </config>
my code for loading the values correctly:
while( xml && xml->read() ) { if (!strcmp("messageText", xml->getNodeName())) starttext = xml->getAttributeValue("starttext"); else if ( !strcmp( "WindowWidth", xml->getNodeName() ) ) params.WindowSize.Width = xml->getAttributeValueAsInt( "width" ); else if ( !strcmp( "WindowHeight", xml->getNodeName() ) ) params.WindowSize.Height = xml->getAttributeValueAsInt( "height" ); else if ( !strcmp( "Fullscreen", xml->getNodeName() ) ) params.Fullscreen = xml->getAttributeValueAsInt( "fullscreen" ); }
and here the code "like in the tutorial". but this doesn't work neither with the text nor the values.
while( xml && xml->read() ) { switch(xml->getNodeType()) { case io::EXN_ELEMENT: if (!strcmp("messageText", xml->getNodeName())) starttext = xml->getAttributeValue("starttext"); break;
default: if ( !strcmp( "WindowWidth", xml->getNodeName() ) ) params.WindowSize.Width = xml->getAttributeValueAsInt( "width" ); else if ( !strcmp( "WindowHeight", xml->getNodeName() ) ) params.WindowSize.Height = xml->getAttributeValueAsInt( "height" ); else if ( !strcmp( "Fullscreen", xml->getNodeName() ) ) params.Fullscreen = xml->getAttributeValueAsInt( "fullscreen" ); break; } }
can someone help me?
|