2

How do I parse the following in TinyXML:

<multi_path literal="not_measured"/>

I am able to easily parse the below line:

<hello>1234</hello>

The problem is that the first statement is not getting parsed the normal way. Please suggest how to go about this.

webgenius
  • 856
  • 3
  • 13
  • 30
  • 2
    You'll have to be more explicit: what does "is not getting parsed the **normal** way" mean ? – ereOn Oct 08 '10 at 08:05

1 Answers1

2

Not 100% sure what youre question is asking but here is a basic format too loop through XML files using tinyXML:

/*XML format typically goes like this:
<Value atribute = 'attributeName' >
Text
</value>
*/
TiXmlDocument doc("document.xml");
bool loadOkay = doc.LoadFile(); // Error checking in case file is missing
if(loadOkay)
{
    TiXmlElement *pRoot = doc.RootElement();
    TiXmlElement *element = pRoot->FirstChildElement();
    while(element)
    {
        string value = firstChild->Value(); //Gets the Value
        string attribute = firstChild->Attribute("attribute"); //Gets the attribute
        string text = firstChild->GetText(); //Gets the text
        element = element->NextSiblingElement();
    }
}
else
{
    //Error conditions
} 
BOMEz
  • 1,020
  • 14
  • 34