static boost::property_tree::ptree ptree_to_xml_(const boost::property_tree::ptree& ptree) { boost::property_tree::ptree out= boost::property_tree::ptree(); //copy all children for (boost::property_tree::ptree::const_assoc_iterator i=ptree.ordered_begin(); i != ptree.not_found(); i++ ) { if(i->second.find("") != i->second.not_found()) { //colapse array for (boost::property_tree::ptree::const_assoc_iterator j=i->second.ordered_begin(); j != i->second.not_found(); j++ ) { out.add_child(i->first, ptree_to_xml_(j->second)); } } else out.add_child(i->first, ptree_to_xml_(i->second)); } out.put_value(ptree.get_value<std::string>()); return out; }