O'Reilly logo

Visual Basic 2008 Recipes: A Problem-Solution Approach by Rakesh Rajan, Matthew MacDonald, Allen Jones, Todd Herman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required