Serializing the book Object to a File
First create a book object and serialize it out to a file. Because the XML format generated by XML streams is difficult to read, transform the output stream to a more easily-readable format.
int main()
{
using std::ofstream; //1
using std::ifstream;
using std::cout;
using std::endl;
book book1("To Love and Be Wise","Josephine Tey"); //2
book book2;
{
ofstream fout("book.xml"); //3
RWObjectOutputStream out = //4
RWEnhancedXmlObjectOutputStreamImp::make(fout);
out << book1; //5
}