Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > irrXML
Parsing Problem

Lord Nyson
Guest
Quote
2009-01-06 14:54:59

Hey there guys, i'm having a bit of trouble, probably stemming from the fact that my coding is rudamentary :)

XML Document

<?xml version="1.0"?>
<data>
     <PositionX x='0' />
     <PositionY y='-200' />
     <PositionZ z='0' />
     <ScalingX x='0.4' />
     <ScalingY y='0.4' />
     <ScalingZ z='0.4' />
     <CenterX x='0' />
     <CenterY y='0' />
     <CenterZ z='0' />
     <Radius x='1000' />
     <Speed x='200' />
     <Direction x='0' />
</data>


Coding

fileName.append(".xml");
IrrXMLReader* reader = createIrrXMLReader(fileName.c_str());

// parse the file until end reached
while(reader->read())
     {
     if (!strcmp("PositionX", reader->getNodeName()))
          posX = reader->getAttributeValueAsFloat("x");
     else
        if (!strcmp("ScalingX", reader->getNodeName()))
          scaleX = reader->getAttributeValueAsFloat("x");
     else
     if (!strcmp("CenterX", reader->getNodeName()))
             rotationCenterX = reader->getAttributeValueAsFloat("x");
     else
     if (!strcmp("PositionY", reader->getNodeName()))
          posY = reader->getAttributeValueAsFloat("y");
     else
     if (!strcmp("ScalingY", reader->getNodeName()))
          scaleY = reader->getAttributeValueAsFloat("y");
     else
     if (!strcmp("CenterY", reader->getNodeName()))
          rotationCenterY = reader->getAttributeValueAsFloat("y");
     else
     if (!strcmp("PositionZ", reader->getNodeName()))
             posZ = reader->getAttributeValueAsFloat("z");
     else
     if (!strcmp("ScalingZ", reader->getNodeName()))
          scaleZ = reader->getAttributeValueAsFloat("z");
     else
     if (!strcmp("CenterZ", reader->getNodeName()))
          rotationCenterZ = reader->getAttributeValueAsFloat("z");
     else
     if (!strcmp("Radius", reader->getNodeName()))
          radius = reader->getAttributeValueAsFloat("x");
     else
     if (!strcmp("Speed", reader->getNodeName()))
          speed = reader->getAttributeValueAsFloat("x");
     else
     if (!strcmp("Direction", reader->getNodeName()))
          direction = reader->getAttributeValueAsFloat("x");
     break;
     };

// delete the xml parser after usage
delete reader;


It appears to read all values at 0. But then again I do have within my code settings to 0 within my constr


urysyf
Guest
Quote
2009-04-24 20:49:06




Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Internationa?" (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