Share via


Save an XML DOM Object to a File (Smart)

 

Saving an XML DOM object is also known as serializing the DOM. It involves a call to the save method on the DOM object. To demonstrate this, we will continue from the previous exercise, and save the DOM object that was loaded from stocks.xml to a different file, myStocks.xml.

This project uses the following files.

Component Description
Source: saveDOMsmart.cpp Saves an XML DOM object, pXMLDom, to a new file.
Output When you build and run the saveDOMsmart project, you should get this output in a console window.

Create the loadDOMsmart Visual C++ project

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

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