#include using namespace std; #include "boost_1_45_0/boost/property_tree/xml_parser.hpp" #include "boost/foreach.hpp" namespace bpt = boost::property_tree; int main() { bpt::ptree pt; try { bpt::read_xml("test.xml", pt, bpt::xml_parser::trim_whitespace || bpt::xml_parser::no_comments); const bpt::ptree::value_type &node = pt.get_child("conf").front(); bpt::ptree pt_block = node.second; string name = pt_block.get("name"); cout << name << "\n"; } catch (bpt::xml_parser_error e) { cout << e.what() << "\n"; return 1; } return 0; }