Solved

MSXML and Visual C++

Posted on 2001-07-19
6
454 Views
Last Modified: 2013-12-14
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.
Thanks.
0
Comment
Question by:eoincorrigan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 6299161
Check out http://support.microsoft.com/support/kb/articles/Q246/2/30.ASP

"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."
0
 

Author Comment

by:eoincorrigan
ID: 6299217
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)) {
          _com_issue_error(hr);
     }
}

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?
0
 
LVL 2

Expert Comment

by:iDeb
ID: 6299601
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).
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Accepted Solution

by:
JackThornton earned 100 total points
ID: 6300475
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.

http://jack.thornton.net/code/XMLTest.zip

0
 
LVL 11

Expert Comment

by:griessh
ID: 6832986
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: http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
0
 
LVL 5

Expert Comment

by:Netminder
ID: 6853057
Per recommendation comment force/accepted by

Netminder
Community Support Moderator
Experts Exchange
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question