I try to parse a simple xml file using Boost library (version 1.57.0.2) and I try to access to link field values.
Please find, here below my xml file :
<?xml version="1.0" encoding="UTF-8"?>
<down>
<food name="cream">
<link name="123" />
<link name="456" />
</food>
<tel name="ice">
<link name="78" />
<link name="90" />
</tel>
</down>
I try to see how to get child of child from web and do the same but I don't understand why it doesn't work with my code.
I have the following error :
error: 'const value_type {aka const struct std::pair<const std::__cxx11::basic_string<char>, boost::property_tree::basic_ptree<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > >}' has no member named 'get_child'|
Please find my code here below :
boost::property_tree::xml_parser::read_xml(path.xml, tree);
BOOST_FOREACH(const boost::property_tree::ptree::value_type &child_tree, tree.get_child("down"))
{
std::string tree_balise = tree.first;
if (tree_balise == "food")
{
BOOST_FOREACH(const boost::property_tree::ptree::value_type &child_of_child_tree, child_tree.get_child("food"))
{
std::cout << "I am in the child of child tree" << std::endl;
}
}
}
Does somebody could tell me why this error appears ? Am I missing something ?
Thank you for your help.
Miwa.