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++
Next, we'll add the source code for the dynamDOMsmart project.