Create an XML Document Dynamically (Smart)

MSXML 5.0 SDK

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

Create an XML Document Dynamically (Smart)

We have already demonstrated how to create an XML DOM object from an existing XML data file. In this section, we will show you how to create an XML document dynamically in an application. Specifically, we will demonstrate how to add processing instructions, comments, elements, and text nodes. We will also show how to use extra white space text nodes to provide a structured format when the DOM object is serialized. Such tasks are useful for creating an XML document that is also easy for humans to read.

Component Description
Source: dynamDOMsmart.cpp Creates an XML document dynamically.
Output When you build and run the dynamDOMsmart project, you should get this output in a console window.

Create the dynamDOMsmart project in Visual C++

  • Create a Win32 console application in Visual C++. For detailed instructions on how to do this, see Set Up My Visual C++ Project. Name the project dynamDOMsmartProj.

Next, we'll add the source code for the dynamDOMsmart project.