Visual Basic 2008 Recipes: A Problem-Solution Approach
by Todd Herman, Allen Jones, Matthew MacDonald, Rakesh Rajan
7.1. Create an XML Document
Problem
You need to create some XML data and save it to a file.
Solution
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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access