Microsoft KB Archive/251273

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 13:51, 21 July 2020 by X010 (talk | contribs) (Text replacement - """ to """)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Base


How to create a new XMLDOM document when you use #import on Msxml.dll in Visual C++

Article ID: 251273

Article Last Modified on 4/29/2005



APPLIES TO

  • Microsoft Visual C++ 6.0 Enterprise Edition
  • Microsoft Visual C++ 6.0 Professional Edition
  • Microsoft Visual C++ 6.0 Standard Edition
  • Microsoft XML Core Services 4.0
  • Microsoft XML Parser 2.5
  • Microsoft XML Parser 2.6
  • Microsoft XML Core Services 4.0



This article was previously published under Q251273

SUMMARY

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.

MORE INFORMATION

The following file is available for download from the Microsoft Download Center:

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

FileName Size
CreateXMLDOMDocument.cpp 4.71KB
CreateXMLDOMDocument.dsp 4.40KB
CreateXMLDOMDocument.dsw 565B



Notes

  1. 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>
                        
  2. 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:
    1. XMLDocTreeBuilderInstrEnum: An enumeration that describes the node type.
    2. 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.
  3. Inline comments are available on major steps.
  4. 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.
  5. 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;
                            


Keywords: kbhowto kbinfo kbdownload kbgraphxlinkcritical kbfile kbsample KB251273