Как перебрать структуру XML в boost :: property_tree
У меня есть структура XML по направлениям:
Который читается вboost::property_tree
, Есть1..Many s, а затем на произвольной глубине внутри этого элемента может быть1..Many s
Есть ли способ перебрать напрямую (в одном цикле) в том порядке, в котором они появляются в документе?
Я посмотрел на equal_range
void iterateOverPoints()
{
const char* test =
""
""
""
""
""
""
""
""
""
""
""
""
""
"";
boost::property_tree::ptree message;
std::istringstream toParse(test);
boost::property_tree::read_xml(toParse,result_tree);
//Now we need to locate the point elements and set the x/y accordingly.
std::pair< boost::property_tree::ptree::const_assoc_iterator,
boost::property_tree::ptree::const_assoc_iterator > result =
message.equal_range("ElementIWant");
for( boost::property_tree::ptree::const_assoc_iterator it = result.first;
it != result.second; ++it )
{
std::cout < it->first < " : ";
const boost::property_tree::ptree& x = it->second.get_child( "