Click to See Complete Forum and Search --> : How to read XML from C++


Danh
November 7th, 2001, 06:36 PM
Hi Code guru,

I know Java that can read XML file. Can C++/VC++ 6.0 read XML file also?
Please show me how or point me the website which I can learn from it.

Thanks for your help,
Have a nice day,

Danh

Rick Zhang
November 8th, 2001, 01:02 AM
#import "msxml.dll" named_guids
using namespacing MSXML;

....

IXMLDOMDocumentPtr pDoc;
pDoc.CreateInstance( CLSID_DOMDocument );

....

pDoc->load( .... )
....

icq: 37175293
oicq: 329170
msn: bbitrickzhang@sina.com
yahoo: rick1126

qingqi
November 16th, 2001, 09:34 PM
Try this.


MSXML2::IXMLDOMDocument2Ptr spDoc;
spDoc.CreateInstance(__uuidof(MSXML2::DOMDocument40));

CComVariant varPath(L"D:\\example.xml");
if(VARIANT_FALSE == spDoc->load(varPath))
{
ATLTRACE(_T("Load Document Failed!\n"));
}





qingqi song