XML Programming using IXMLDOMDOCUMENT in vc++
Here the sample code to start XML programming using XML dom parser.
// TestXML1.cpp : Defines the entry point for the console application.
//
#import
#include "stdafx.h"
#include
#include
#include
//sample xml u can copy paste it in note pad and save it with .xml extension and store in location c:\
int _tmain(int argc, _TCHAR* argv[])
{
CoInitialize (NULL);
CComPtr< IXMLDOMDocument > pXMlDoc = NULL;
HRESULT hr = CoCreateInstance(__uuidof(DOMDocument), NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pXMlDoc));
VARIANT_BOOL boolval;
CComVariant path ="c:\\cdcat.xml";
hr = pXMlDoc->load(path,&boolval);
BSTR val ;
pXMlDoc->get_xml(&val);
MessageBox(0,val,_T("TEST"),0);
pXMlDoc = NULL;
CoUninitialize();
return 0;
}
// TestXML1.cpp : Defines the entry point for the console application.
//
#import
#include "stdafx.h"
#include
#include
#include
//sample xml u can copy paste it in note pad and save it with .xml extension and store in location c:\
int _tmain(int argc, _TCHAR* argv[])
{
CoInitialize (NULL);
CComPtr< IXMLDOMDocument > pXMlDoc = NULL;
HRESULT hr = CoCreateInstance(__uuidof(DOMDocument), NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pXMlDoc));
VARIANT_BOOL boolval;
CComVariant path ="c:\\cdcat.xml";
hr = pXMlDoc->load(path,&boolval);
BSTR val ;
pXMlDoc->get_xml(&val);
MessageBox(0,val,_T("TEST"),0);
pXMlDoc = NULL;
CoUninitialize();
return 0;
}
Comments