XML Modification
Modifying XML data is easier than ever with the LINQ to XML API. With just a handful of methods, you can perform all the modifications you could want. Whether it is adding, changing, or deleting nodes or elements, there is a method to get the job done.
As has been stated time and time again, with the LINQ to XML API, you will be working with XElement objects most of the time. Because of this, the majority of these examples are with elements. The LINQ to XML API classes inheriting from XNode are covered first, followed by a section on attributes.
Adding Nodes
In this section on adding nodes to an XML tree, I start with a base example of the code in Listing 7-62.
Example. A Base Example with a Single Book Participant
// A document ... |
Get Pro LINQ: Language Integrated Query in C# 2008 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.