Parsing <multi_path literal=“not_measured”/> in TinyXML

痴心易碎 提交于 2019-12-11 03:58:32

问题


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.


回答1:


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
} 


来源:https://stackoverflow.com/questions/3888694/parsing-multi-path-literal-not-measured-in-tinyxml

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!