Overview
Features
Download
Documentation
Community
Add-Ons & Services

How simply save XML document to string,to file and from file

Please post support and help requests here.

How simply save XML document to string,to file and from file

Postby pdf » 20 Jul 2012, 16:29

Hello,

I work with a simple (small) XML structure as for exemple :

Code: Select all
Poco::AutoPtr< Poco::XML::Document> data;
data->appendChild( data->createElement( typeid( *this).name()));
data->documentElement()->setAttribute( "creation", _creation.toString());
data->documentElement()->setAttribute( "emission", _emission.toString());


and i want simply :
- convert the full XML document to a string :
Code: Select all
std::string s = data->toString();

- reload the XML document from the previous string :
Code: Select all
data->fromString( s);

- save the XML document to a disk file :
Code: Select all
data->saveToFile( "c:\dump.xml");

- reload the document from the file :
Code: Select all
data->loadFromFile( "c:\dump.xml");


How to do that ?

Best regards.
pdf
 
Posts: 2
Joined: 19 Jul 2012, 22:54

Return to Support

Who is online

Users browsing this forum: No registered users and 1 guest