TinyXML で次を解析するにはどうすればよいですか。
<multi_path literal="not_measured"/>
以下の行を簡単に解析できます。
<hello>1234</hello>
問題は、最初のステートメントが通常の方法で解析されないことです。これについてどうすればよいか提案してください。
あなたの質問が何を求めているのか 100% 確実ではありませんが、tinyXML を使用して XML ファイルをループする基本的な形式を次に示します。
/*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
}