I'm using TinyXML without STL and I wanted to know if there is a way to retrieve the XML string into a variable instead of saving it into a file or using the stdout.
What I've done is put public the TiXmlDocument::StreamOut() function instead of protected. This seems to work.
Is there another way so I don't have to change the code?
Thanks. And by the way, this is a great parser!
Jonathan
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm using TinyXML without STL and I wanted to know if there is a way to retrieve the XML string into a variable instead of saving it into a file or using the stdout.
What I've done is put public the TiXmlDocument::StreamOut() function instead of protected. This seems to work.
Is there another way so I don't have to change the code?
Thanks. And by the way, this is a great parser!
Jonathan
Here is a function I'm using :
std::string s_get_xml_string (const TiXmlNode * XNp_ptr)
{
std::string s;
std::ostringstream os_stream (std::ostringstream::out);
os_stream << * XNp_ptr;
s = os_stream . str ();
return s;
}
Yves
Thanks for your reply. But this only works when you use TinyXml with STL and I don't :(
Jonathan
Try something like this:
...
TiXmlOutStream s;
s << *node;
const char* p = s.c_str();
...
Nicola
That's it! Thank you very much!
Jonathan