DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/)
-   XML, XSLT and XPATH (http://www.daniweb.com/forums/forum134.html)
-   -   write/Read into XML File Using VC++ 6.0 please help me (http://www.daniweb.com/forums/thread116719.html)

spoorthisri Apr 1st, 2008 3:15 am
write/Read into XML File Using VC++ 6.0 please help me
 
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>

spoorthisri Apr 1st, 2008 7:20 am
how to write multiple records into Single XML file using VC++6.0
 
Hi,

how to write multiple records into Single XML file using VC++6.0

Thank u ,
Spoorthi


All times are GMT -4. The time now is 2:19 am.

Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC