C++ 如何使用tinyxml2查询字符串属性?
嗨,有人知道如何使用tinyxml2查询字符串变量中的属性吗 例如:C++ 如何使用tinyxml2查询字符串属性?,c++,xml,tinyxml2,C++,Xml,Tinyxml2,嗨,有人知道如何使用tinyxml2查询字符串变量中的属性吗 例如: <pattern> <distances numberOfDistances="1" realWorldPixelSize="0.26428571428571429"> <markerDistance linkName="AB" distance="58.624385902531891"/> </distances> </pattern>
<pattern>
<distances numberOfDistances="1" realWorldPixelSize="0.26428571428571429">
<markerDistance linkName="AB" distance="58.624385902531891"/>
</distances>
</pattern>
我认为对于一根弦来说,它应该是这样的:
std::string linkName;
child->QueryAttribute("linkName", &linkName);
但对于字符串来说,似乎没有过载 好的,我找到了
使用:
std::string linkName;
child->QueryAttribute("linkName", &linkName);
const char * name
name = child->Attribute("linkName");