You can try something like this (with proper error handling):
#include <boost/property_tree/xml_parser.hpp>
#include <boost/property_tree/exceptions.hpp>
#include <sstream>
#include <iostream>
using namespace boost;
using namespace boost::property_tree;
using namespace std;
int main()
{
ptree pt;
{
std::stringstream strm;
strm << "<?xml version='1.0' encoding='utf-8'?> <tokens title='issues'></tokens>";
read_xml(strm, pt);
}
pt.find("tokens")->second.erase("<xmlattr>");
write_xml(cout, pt, xml_writer_make_settings(' ', 2));
}
Output:
$ ./test
<?xml version="1.0" encoding="utf-8"?>
<tokens/>