Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > irrXML
Double-using code of read xml-file

Dron
Guest
Quote
2009-04-27 16:09:01

Hello. I have problem about re-using code of read xml-file. I create simle example, that showing my problem. Download - http://dronchik.3dn.ru/irrXML-test.rar .


Dron
Guest
Quote
2009-04-27 16:09:40

Source code:
include "SDK 1.4.2/include/irrlicht.h"
include <iostream>

pragma comment(lib, "SDK 1.4.2/lib/Win32-visualstudio/Irrlicht.lib")

using namespace std;
using namespace irr;
using namespace io;

void main()
{
//create xml reader, read information from xml-file and write to console
io::IrrXMLReader* xml = io::createIrrXMLReader("scripts/Pripyat'.xml");
while(xml && xml->read())
{
switch(xml->getNodeType())
{
case io::EXN_TEXT:
break;
case io::EXN_ELEMENT:
if (core::stringc("maps") == xml->getNodeName())
{
cout<<endl<<xml->getAttributeValueAsFloat("X_rot")<<endl;
}
else
if (core::stringc("points") == xml->getNodeName())
{
cout<<endl<<xml->getAttributeValueAsFloat("m0_X")<<endl;
}
}
}

delete xml;

/////////////////////////////////////////////////////////////////////////////////////////////////
//this code can't doing //////////////////////////////////////////////////////////////////////
//why? I don't know :( //////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
io::IrrXMLReader* xml2 = io::createIrrXMLReader("scripts/p90big.xml");

while(xml2 && xml2->read())
{
switch(xml2->getNodeType())
{
case io::EXN_TEXT:
break;
case io::EXN_ELEMENT:
if (core::stringc("guns") == xml2->getNodeName())
{
cout<<endl<<xml2->getAttributeValueAsFloat("Z_pos")<<endl<<endl;
}
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////
//end of haven't done code /////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////

int i=0;
cin>>i;
}



niko
Moderator
Quote
2009-04-27 16:34:47

When using irrlicht, use the interface for creating the reader instead of the createIrrXMLReader function, it is not exported.


Dron
Guest
Quote
2009-04-29 07:52:56

Niko, thanks for answer, but i didn't understand you answer fully. I'd like example for you answer, pls!


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Int?rnational" (you are not logged in)


Text:

 

  

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