1
我想解析包含特定属性的节点的随机xml文件,并检索此属性的所有值。用例是有许多具有不同节点的XML,但要检索的属性始终是已知的。C++ Boost循环通过未知的ptree和属性列表值
下面是一个文件的例子:
<node>
<container>
<object attribute="value" />
<object attribute="value" />
<container/>
<supercontainer>
<subcontainer>
<otherobject attribute="value" />
<subcontainer/>
<supercontainer/>
</node>
这是我现在使用升压property_tree但我不知道该怎么在循环做:
ptree pt;
read_xml(xml_file, pt);
BOOST_FOREACH(boost::property_tree::ptree::value_type &ele, pt)
{
//NO IDEA
}
思路欢迎。
感谢