Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



How to export data to XML from the visual C++

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 25-06-2011
Member
 
Join Date: Jun 2011
Posts: 61
How to export data to XML from the visual C++
  

Hi I have developed application using the visual C++ and I am in great trouble right now, I mean to say that I require some reference to export few data in XML format using VC++, but donít know how to do that exactly, but I am aware about some libraries and all that things, through which we can do this but donít know exactly how can we do that, I prefer MFC compatible classes, and need some proper explanation. Thanks.

Reply With Quote
  #2  
Old 25-06-2011
Member
 
Join Date: Apr 2009
Posts: 562
Re: How to export data to XML from the visual C++

You need to have some XML parser for these to export the data from the VC++ to the XML, but and you have to write different application to export those data to the XML format. And as the extent to I know you can use Dom Parser for this, off course first of all you have to download it from the internet, and then make use in the programming. And if suppose you still have some doubts you can simply refer to the MSDN library.
Reply With Quote
  #3  
Old 25-06-2011
Member
 
Join Date: May 2009
Posts: 528
Re: How to export data to XML from the visual C++

you can do this with the coding only, and for that you need to import some of the files and the libraries in your coding, see you can try this.

Code:
#import <msxml.dll> named_guids
using namespace MSXML;
And as the above user has mentioned, you have to use the DOM parser which is very good interface load the XML files.
Reply With Quote
  #4  
Old 25-06-2011
Member
 
Join Date: Apr 2009
Posts: 477
Re: How to export data to XML from the visual C++

See first of all you need to create the XML file and then you have to import it in the visual C++ program using the name that you have mentioned. See I would like to give you one best example.

XML file

Code:
<?xml version="1.0"?>
<cars>
  <company name="AUDI">
    <producer name="ABC">
      <model>X6 Convertible</model>
      <price currency="usd">60,000</price>
      <horsePower>6000</horsePower>
      <fuelCapacity units="gallons">13.5</fuelCapacity>
    </make>
  </company>
  <company name="Mercedes">
    <make name="benz">
      <model>test model</model>
      <price currency="usd">30,000</price>
      <horsePower>5000</horsePower>
      <fuelCapacity units="gallons">15.5</fuelCapacity>
    </make>
  </company>
</cars>
After creating this files save it. And then load it in the VC++ program, remember that you have to import some related libraries also. Then make a new Visual C++ project called XMLDOMFromVC, and in the In the MFC AppWizard, describe the project as being a dialog-based application.

Code:
BOOL CXMLDOMFromVC::InitInstance()
{
 AfxEnableControlContainer();

 // .. statements 

 ::AfxOleInit();

 //..statements
return FALSE;
}
Reply With Quote
  #5  
Old 25-06-2011
Member
 
Join Date: May 2009
Posts: 518
Re: How to export data to XML from the visual C++

VC++.NET Data Retrieval and Export Application, allows a user to save the records in the grid to XML. And you can choose that data from almost each applications like either a SQL Server or Oracle or the Microsoft Access etc. And this is the application that you can download from the internet also and I have seen that on internet like you can download it for free also as a thirty days trial period.
Reply With Quote
  #6  
Old 26-06-2011
Member
 
Join Date: May 2009
Posts: 602
Re: How to export data to XML from the visual C++

See I have another idea also through which you can do the same, for that first of all you have to develop one class which will behave as usual std::stream but as well follow all the needed XML markings.
Refer this code, and let me tell you this is just as an example, of course you have to make changes in your program, but before that include this library.

Code:
#include "engine.h"
#define BUFSIZE 256
ofstream a("example.xml");
XmlStream xml(a);

xml << prolog() 

  << tag("example-tag")

    << tag("some-tag") 

      << attr("int-attribute") << 1234
      << attr("double-attribute") << 345.789
      << chardata() << "This is the text"
    << endtag()

    << tag("empty-self-closed-tag") 
    << endtag()

    << tag() << "computed-name-tag"
      << attr("text-attribute") << "a byte of text"
    << endtag()

    << tag("deep-tag") 
      << tag("sub-tag-2")
        << tag("sub-tag-3")
    << endtag("deep-tag"); 
After this, used it in the VC++ program
template<class t> XmlStream& operator<<(const t& value) {
  
  if (stateTagName == state)
 
    tagName << value;

  s << value;
  return *this;
}
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to export data to XML from the visual C++"
Thread Thread Starter Forum Replies Last Post
How to Export and Import DATA from Tally SoftwareGuy Tips & Tweaks 3 08-03-2012 02:18 AM
Import & Export Data AnkitSingh007 Off Topic Chat 2 09-12-2011 03:18 PM
Specification of FlySpeed Data Export 5.0 Crespin Windows Software 4 23-03-2010 11:11 AM
How to export DHCP data to notepad Jacek Networking & Security 2 25-11-2008 05:20 PM
Export Project Data to Excel Asgar Microsoft Project 3 20-06-2007 07:56 AM


All times are GMT +5.5. The time now is 03:00 AM.