Chapter 9. LINQ to XML

In This Chapter

  • Using XML with LINQ

  • Considering the LINQ to XML API

  • Working with the XML operators

  • Developing a simple XML query

XML is one of those technologies that seem extremely simple to use once you overcome the learning curve to understand them. The usesof XML extend to everything from application settings storage to Web service data retrieval. In fact, XML often appears in files that don't have an XML extension — consider the CONFIG file used by .NET applications and all the settings files that Windows uses today. A number of databases even support XML directly — perhaps not as their native storage media, but as an option. You'd be hard pressed to find an application or a technology that doesn't include XML in some way, unless the application is so simple that it doesn't require anything more than extremely simple data storage (such as Notepad).

Because XML appears just about everywhere, it's possible that you'll find more use for the LINQ to XML provider than just about any other provider available today. In addition, because XML provides a hierarchical storage technology, the LINQ to XML applications you create will probably have more robust storage options than any other provider described in this book.


An interesting side effect of the LINQ to XML provider is that it offers a better method of manipulating XML data than more direct methods in many cases. LINQ provides an alternative to the kludge method of changing XML data element-by-element that you ...

Get LINQ For Dummies® now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.