Get Ready to Work with MSXML (C/C++)

MSXML 5.0 SDK

Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - DOM Developer's Guide

Get Ready to Work with MSXML (C/C++)

To work with MSXML, you must have:

  • An appropriate version of MSXML installed on your machine.
  • The MSXML libraries and headers incorporated into your project.

The following is a detailed discussion of these requirements.

Installing MSXML Components

To work with MSXML, you must have the module installed on your machine. To verify this, search for the mxsmlX.dll libraries in the $sysRoot\system32 directory, where X is the version number and $sysRoot is the system directory. By default, this is c:\windows for machines running Windows XP/ME/98/95, and c:\WinNT for machines running Windows 2000/NT. For example, installing MSXML 5.0 copies the msxml5.dll file (as well as msxml5a.dll and msxml5r.dll) to the system directory, and registers the DLL in the system's registry.

If you are accessing the required DLLs from another local host, instead of downloading them from the Web site, you can install MSXML manually.

To install MSXML manually

  1. Copy the DLLs to the system directory on your working machine.
  2. Register the DLLs by typing the following at a command prompt:
    cd c:\windows\system32
    regsvr32 msxml5.dll

You can install other versions of MSXML in the same way.

Importing Headers and Libraries

After MSXML is installed, you need to set up your application project so that calls to the MSXML-supported APIs are resolved properly when the application is built. In Microsoft Visual C++, you must import the MSXML headers and libraries into your project.

There are two ways to instruct your application to use the DOM interfaces: You can include headers and libraries automatically, or manually. The first approach below is simple; Visual Studio does all the work for you. The second approach is more traditional.

To include headers and libraries automatically

  • Add the following two lines to your source code:
    #import <msxml5.dll> raw_interfaces_only
    using namespace MSXML2;

To include headers and libraries manually