Modifying XML Trees (LINQ to XML)
LINQ to XML is an in-memory store for an XML tree. After you load or parse an XML tree from a source, LINQ to XML lets you modify that tree in place, and then serialize the tree, perhaps saving it to a file or sending it to a remote server.
When you modify a tree in place, you use certain methods, such as Add.
However, there is another approach, which is to use functional construction to generate a new tree with a different shape. Depending on the types of changes that you need to make to your XML tree, and depending on the size of the tree, this approach can be more robust and easier to develop. The first topic in this section compares these two approaches.
In This Section
Topic |
Description |
---|---|
In-Memory XML Tree Modification vs. Functional Construction (LINQ to XML) |
Compares modifying an XML tree in memory to functional construction. |
Provides information about adding elements, attributes, or nodes to an XML tree. |
|
Provides information about modifying existing elements, attributes, or nodes. |
|
Provides information about removing elements, attributes, or nodes from the XML tree. |
|
Describes how to maintain application information that is best kept as name/value pairs, such as configuration information or global settings. |
|
Shows how to move an XML tree from one namespace into another. |