7.1. Create an XML Document
You need to create some XML data and save it to a file.
Use XML literals to create a System.Xml.Linq.XElement object, and then use the Save method to save the XML tree to a file.
How It Works
The .NET Framework provides several different ways to process XML documents. The one you use depends on the programming task you are attempting to accomplish. The .NET Framework 3.5 includes classes that provide the functionality to manipulate and query XML files. Although all previous versions of .NET supported similar functionality, the new LINQ to XML classes, the most common of which can be found in Table 7-1, have greatly enhanced its support of the W3C Document Object Model (DOM). The DOM dictates how XML ...