Please help me how to write into XML file using VC++ 6.0
this is example code where i am not able to write the data into XML File
this is ScanComputer.cpp where i am trying to try into XML file
void CScanComputer::saveParameters(const char *filename)
{
ParamIO outXml;//ParamIO.h is pasted below this
writeParameters(outXml);
outXml.writeFile(filename);
}
void CScanComputer::writeParameters(ParamIO &outXml)
{
outXml.write("PARAMS:NAME",fname1);//fname1 is the string variable where i am getting the value
outXml.write("PARAMS:EMAILID",Path1);//Path1i s the string variable where i am getting the value
outXml.write("PARAMS:DOB",cell2);//cell2is the string variable where i am getting the value
}
#include "ParamIO.h"
void ParamIO::parseAccess(const char *str, std::vector<std::string> &access)
{
access.clear();
if(str == 0 || strlen(str) == 0)
{
return;
}
std::istringstream stream(str);
char *char_str = new char[strlen(str)];
while(stream.getline(char_str, strlen(str), ':'))
{
access.push_back(std::string(char_str));
}
delete[] char_str;
}
void ParamIO::writeStream(std::ostream &os) const
{
_treeBuilder.print(os);
}
void ParamIO::writeFile(const char *filename) const
{
std::ofstream os(filename);
writeStream(os);
os.close();
}
I am getting this output like name=003BEC20 instead of getting actual values of the variable
OUTPUT
<PARAMS>
<NAME>003BEC20</NAME> //instead of the value of the string variable it is taking as 003BEC20 etc
<EMAILID>01970328</EMAILID>
<DOB>003BEEA0</DOB>
</PARAMS>