ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > irrXML
forum topic indicator irrXML help please?
person icon
grizzlebee
Guest
Quote
2007-04-16 20:41:05

Hi, I have an XML file that looks like this:
<Environment>
<Viewport Color="0,128,192" Fov="0" NearClip="-0.000000" FarClip="0.000000" />
</Environment>

How do I get the pointer to child node? I have this so far syntax but it seems not to work:( Thank u.

while(xml && xml->read()) {
If (xml->GetNodeName()=="Environment") {
If (xml->GetNodeName()=="Viewport") {
std::string EnvColor = xml->getAttributeValue("Color");
std::string EnvFov = xml->getAttributeValue("Fov");
std::string EnvNearClip = xml->getAttributeValue("NearClip");
std::string EnvFarClip = xml->getAttributeValue("FarClip");
}
}
}

person icon
pfo
Guest
Quote
2007-04-16 20:41:38

What you want to do is this:

while (xml && xml->read()) 
{
core::stringw element = xml->getNodeName();
switch (xml->getNodeType())
{
case io::EXN_ELEMENT:
if (element == L"Environment")
;// there are no data items for environment
if (element == L"Viewport")
{
core::stringw color = xml->getAttributeValue(L"Color");
float FOV = xml->getAttributeValueAsFloat();
// etc....
}
}


Only 1 node can be the active node at a time. For your <environment> </environment> tags, you could set a boolean environment variable to true if you need to, but since they contain no data items you might as well ignore them.

person icon
grizzlebee
Guest
Quote
2007-04-16 20:42:00

h i see. Thanks It worked great.


Create reply:










 

  

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


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |