string outputFileName("");
cout << "What would you like your XML file to be named?" << endl;
cin >> outputFileName;
ofstream outputFile(outputFileName.c_str());
and then pass outputFile as your ostream & to ouputXML()? You'd also have to somehow connect it with XMLSerializable::dumpObject()...
Exactly! Yes how would I do that? right now I have..
1 2 3 4 5
string outputFileName("");
cout << "What would you like your XML file to be named?" << endl;
cin >> outputFileName;
ofstream outputXML(outputFileName.c_str());
Also here is what it actually does in the Entity.cpp file that inherits from the XML base class. (NOTE: not all of the code in Entity.cpp) Entity.cpp is connected to Entity.h which inherits from XMLSerializable.h
I'm sorta shooting in the dark here, so apologies in advance.
As far as dumpObject goes, it appears you are tied into cout, if you are allowed to change the code, maybe add an ofstream member, initalise it with ofstream::open (outputFileName) and use it instead of cout.
Although it souds to me like dumpObject is intended to be a debug tool and functions:
are looking very interesting indeed. I can easily see a scenario like: (*it)->writeFragment(outputXML); replacing the line 43 in the loop in your first code post above.
outputXML writes 2 lines ("<?xml version=\"1.0\" encoding = \"utf-8\"?>" and "<World>") to the ostream& it's given, then repeatedly calls dumpObject, which calls dumpObjectData, which both ultimately write to cout.
My understanding was that you want that output in your user supplied output file instead of on cout