Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 251273 - Last Review: April 29, 2005 - Revision: 4.0
How to create a new XMLDOM document when you use #import on Msxml.dll in Visual C++
This article was previously published under Q251273
NewXMLDOC.exe is a Visual C++ sample that shows you how to
create a new XMLDOM document from scratch when you use #import on Msxml.dll.
The
following file is available for download from the Microsoft Download
Center:
Collapse this imageExpand this image
Download NewXMLDOC.exe now
(http://download.microsoft.com/download/vstudio60ent/sample/new/win98/en-us/newxmldoc.exe)
Release Date: July 12,
2000
For additional information about how to download Microsoft
Support files, click the following article number to view the article in the
Microsoft Knowledge Base:
119591Â
(http://kbalertz.com/Feedback.aspx?kbNumber=119591/EN-US/
)
How to Obtain Microsoft Support Files from Online Services
Microsoft scanned this file for viruses. Microsoft used the most
current virus-detection software that was available on the date that the file
was posted. The file is stored on security-enhanced servers that help to
prevent any unauthorized changes to the file.
NewXMLDOC.exe contains the files listed in the following
table.
Collapse this tableExpand this table
| FileName | Size |
|---|
| CreateXMLDOMDocument.cpp | 4.71KB |
| CreateXMLDOMDocument.dsp | 4.40KB |
| CreateXMLDOMDocument.dsw | 565B |
Notes- The sample shows how to create a simple XML document with
the following structure:
<Customers>
<customer id=345>
<name FirstName="Jane" LastName="Doe"/>
<orders>
<order Date=07/16/98 ProductName="Visual Basic" />
<order Date=07/23/98 ProductName="Visual C++" />
</orders>
</customer>
</Customers>
- Inside the sample, the majority of the work is accomplished
within the BuildTree() function. Notice that the sample also contains the following two
structures that are defined to facilitate the building of the tree:
- XMLDocTreeBuilderInstrEnum: An enumeration that describes the node type.
- XMLDocSourceData: The actual data used to create the node. The BuildTree() function accepts an array of the XMLDocSourceData datatypes and uses this array to build XMLDOMDocument.
- Inline comments are available on major steps.
- On Windows NT 4.0 platform, if you download the NT 5.0
header files for XML samples and you get the following compiler errors:
c:\workshop\include\nt50\ocidl.h(3233) : error C2061:
syntax error : identifier 'IPropertyBag'
You need to alter the order
of the new Windows 2000 header directories to the end of the search
path. - The code sample uses #import on msxml.dll, which is for the
MSXML 2.5 parser. If you have the MSXML 2.6 or MSXML 3.0 parser installed on
the system, comment out the following code block:
#import "msxml.dll"
using namespace MSXML;
and add following correspondingly:
#import "msxml2.dll" //msxml 2.6 parser
using namespace MSXML2;
or
#import "msxml3.dll" //msxml 3.0 parser
using namespace MSXML2;
or
#import "msxml4.dll" //msxml 4.0 parser
using namespace MSXML2;
APPLIES TO
- Microsoft Visual C++ 6.0 Enterprise Edition
- Microsoft Visual C++ 6.0 Professional Edition
- Microsoft Visual C++, 32-bit Learning Edition 6.0
- Microsoft XML Core Services 4.0
- Microsoft XML Parser 2.5
- Microsoft XML Parser 2.6
- Microsoft XML Parser 3.0
| kbhowto kbinfo kbdownload kbgraphxlinkcritical kbfile kbsample KB251273 |
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate