Reputation: 459
if I have xml content as below
<node>
<content> hello <b>world</b>
<image src="src/image.jpg"/>
</content>
</node>
I would like to get value as string which have all data inside or let say
string all_data = node->get_XXXX????();
Finally all_data =="< content > hello < b >world < /b > \n < image src=\"src/image.jpg\"/>\n < /content > "
Upvotes: 1
Views: 951
Reputation: 68033
You need to print
it using functions in rapidxml_print.hpp
See here. http://rapidxml.sourceforge.net/manual.html#namespacerapidxml_1printing
// Print to string using output iterator
std::string s;
print(std::back_inserter(s), node, 0);
Be aware that this will potentially reformat whitespace, etc around tags. If that's critical to you, you should find a different way of encoding your document.
Upvotes: 0