I've been using boost libraries to parse XML files and I have to create a ptree manually. I need to add an XML attribute to the ptree. This is what the boost documentation suggests:
ptree pt;
pt.push_back(ptree::value_type("pi", ptree("3.14159")));
That adds a element with content, but I also need to add an attribute to the element.
The code above produces:
<pi>3.14</pi>
I need to add something like this:
<pi id="pi_0">3.14</pi>
What do I need to change, to add the attribute id="pi_0"
?