
Demetrius Cassidy wrote:
Reading the tutorial for property_tree, using the functions ptree.find, ptree.get and ptree.get_child, they will only return the topmost node, so if I had two different children nodes under my root named '<Logistics>' with different data within the children, I would only be able to access the first one.
So my question is that how would I go about navigating to each top node under my root when they are all named the same?
[snip]
I basicly will have a file that looks something like this:
XML file contents: <Technologies> <Logistics ID="Damage Diagnostics">
[snip]
</Logistics> <Logistics ID="Basic Self-Repair"> /* I need to access this node */
[snip]
</Logistics> </Technologies>
Well, something along the lines of this should work (caution: not tested): ptree technologies; /* load xml */ for (ptree::const_iterator iter = technologies.begin(); iter != technologies.end(); ++iter) { std::cout << "ID: " << (*iter).getstd::string("<xmlattr>.ID") << '\n'; } HTH // Johan