MSXML and Visual C++

I want to create a simple dialog based application that uses MSXML.  Could someone provide a simple step by step guide to creating and populating a DOM document from an XML disk file.  Once the DOM document is populated I want to use it to populate a tree control.
No bells and whistles please, just the bare minimum.
Who is Participating?

Improve company productivity with a Business Account.Sign Up

JackThorntonConnect With a Mentor Commented:
I've put a test (MFC) application that did exactly this up on my web site. Probably more code than you want, but was easier to zip it all up.

Check out

"XMLTree.exe is a sample that demonstrates how to use the MSXML XML DOM interfaces from a C++ application.

XMLTree loads XML documents from a URL and graphically displays them in a tree view. It allows manipulation
of the XML data on a node-by-node basis and supports saving the data out to a file on the local disk."
eoincorriganAuthor Commented:
I was working from this example originally before I decided to post my request on EE.  I ran through it a number of times and started to extract the sections I wanted to include in my (even simpler) version.
I ran into trouble in OnOpenURL( ) where the DOM Document pointer is created...

MSXML::IXMLDOMDocumentPtr pDOMDoc(__uuidof(MSXML::DOMDocument));

It compiled, and I traced through to where CreateInstance( ) is called in COMIP.h...

// Calls CoCreateClass with the provided CLSID.
explicit _com_ptr_t(const CLSID& clsid, IUnknown* pOuter = NULL, DWORD dwClsContext = CLSCTX_ALL) throw(_com_error): m_pInterface(NULL)
     HRESULT hr = CreateInstance(clsid, pOuter, dwClsContext);

     if (FAILED(hr) && (hr != E_NOINTERFACE)) {

Basically CreateInstance( ) failed and the value of hr was no good, the DOM Pointer creation failed.

Are there additional files I need to include in my project before the (__uuidof(MSXML::DOMDocument))
method of DOM pointer creation will work?
Or is there a simpler way without the overhead?
What is the Events Sink for?
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

you might want to check in the COM/OLE viewer if the class you are trying to create in CreateInstance is there in the registry(registered).
I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. Unless there is objection or further activity,  I will suggest to accept "jackThornton" comment(s) as an answer.

If you think your question was not answered at all, you can post a request in Community support (please include this link) to refund your points.
The link to the Community Support area is:

Per recommendation comment force/accepted by

Community Support Moderator
Experts Exchange
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.