≡
Products
▼
Support
▼
Company
▼
Forum
Ambiera Forum
Discussions, Help and Support.
Create a new account
,
Search
, or Login:
Create reply in
Problem parsing string and values
Posted by:
(you are not logged in)
Enter the missing letter in: "Internati?nal"
(you are not logged in)
Text:
[quote][b]Quillraven[/b] wrote: 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: [code] <?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> [/code] my code for loading the values correctly: [code] 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" ); } [/code] and here the code "like in the tutorial". but this doesn't work neither with the text nor the values. [code] 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; } } [/code] can someone help me?[/quote]
Possible Codes
Feature
Code
Link
[url] www.example.com [/url]
Bold
[b]bold text[/b]
Image
[img]http://www.example.com/image.jpg[/img]
Quote
[quote]quoted text[/quote]
Code
[code]source code[/code]
Emoticons
Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact