本文介绍了解析< multi_path文字="not_measured"/.在TinyXML中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在TinyXML中解析以下内容:

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.

推荐答案

不是100%肯定您要问的问题,但这也是一种基本格式,也可以使用tinyXML遍历XML文件:

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
} 

这篇关于解析&lt; multi_path文字="not_measured"/.在TinyXML中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 22:35