User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the XML, XSLT and XPATH section within the Software Development category of DaniWeb, a massive community of 361,943 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,690 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our XML, XSLT and XPATH advertiser:
Views: 2037 | Replies: 1
Join Date: Apr 2008
Posts: 2
Reputation: spoorthisri is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
spoorthisri spoorthisri is offline Offline
Newbie Poster

write/Read into XML File Using VC++ 6.0 please help me

  #1  
Apr 1st, 2008
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

  1. void CScanComputer::saveParameters(const char *filename)
  2. {
  3.  
  4. ParamIO outXml;//ParamIO.h is pasted below this
  5.  
  6. writeParameters(outXml);
  7. outXml.writeFile(filename);
  8. }
  9.  
  10. void CScanComputer::writeParameters(ParamIO &outXml)
  11. {
  12.  
  13. outXml.write("PARAMS:NAME",fname1);//fname1 is the string variable where i am getting the value
  14. outXml.write("PARAMS:EMAILID",Path1);//Path1i s the string variable where i am getting the value
  15.  
  16. outXml.write("PARAMS:DOB",cell2);//cell2is the string variable where i am getting the value
  17.  
  18.  
  19. }


  1. #include "ParamIO.h"
  2.  
  3. void ParamIO::parseAccess(const char *str, std::vector<std::string> &access)
  4. {
  5. access.clear();
  6. if(str == 0 || strlen(str) == 0)
  7. {
  8. return;
  9. }
  10. std::istringstream stream(str);
  11. char *char_str = new char[strlen(str)];
  12. while(stream.getline(char_str, strlen(str), ':'))
  13. {
  14. access.push_back(std::string(char_str));
  15. }
  16. delete[] char_str;
  17.  
  18. }
  19.  
  20. void ParamIO::writeStream(std::ostream &os) const
  21. {
  22. _treeBuilder.print(os);
  23. }
  24.  
  25.  
  26.  
  27. void ParamIO::writeFile(const char *filename) const
  28. {
  29. std::ofstream os(filename);
  30. writeStream(os);
  31. os.close();
  32. }

I am getting this output like name=003BEC20 instead of getting actual values of the variable

OUTPUT

  1. <PARAMS>
  2. <NAME>003BEC20</NAME> //instead of the value of the string variable it is taking as 003BEC20 etc
  3. <EMAILID>01970328</EMAILID>
  4. <DOB>003BEEA0</DOB>
  5. </PARAMS>
Last edited by peter_budo : Apr 1st, 2008 at 7:18 am. Reason: Keep It Organized - please use [code] tags
AddThis Social Bookmark Button
Reply With Quote  

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb XML, XSLT and XPATH Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the XML, XSLT and XPATH Forum

All times are GMT -4. The time now is 11:38 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC