1

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 > "

Denny
  • 449
  • 4
  • 17

1 Answers1

0

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.

Roddy
  • 66,617
  • 42
  • 165
  • 277