Chapter 9. Introducing LINQ to XML
This chapter covers
- LINQ to XML design principles
- LINQ to XML class hierarchy
- Loading, parsing, and manipulating XML
In the first three parts of this book, we introduced you to the new language features in C# and VB that help enable LINQ, the default implementation of the standard query operators that work over objects—LINQ to Objects—as well as the implementation of LINQ for working with relational data—LINQ to SQL. In this chapter, we introduce you to another import piece of LINQ—LINQ to XML.
LINQ to XML allows you to use the powerful query capabilities offered by LINQ with XML data. Rather than learn a new API for querying XML, we can stick with the familiar query syntax that we’ve already learned for querying objects and relational data.
In addition to allowing us to query XML using LINQ, LINQ to XML also provides developers with a new XML programming API. The programming API is a lightweight, in-memory API that has been designed to take advantage of the latest .NET Framework. It provides functionality similar to the DOM, but does so with a redesigned API that is more intuitive.