© Jonathan Hartwell 2017

Jonathan Hartwell, C# and XML Primer, 10.1007/978-1-4842-2595-0_3

3. Modifying XML

Jonathan Hartwell

(1)Joliet, Illinois, USA

Reading XML is only one part of handling XML in C#. Once you have an XML document loaded, there are times you need to make modifications, especially if you plan to write the XML back to file. The following steps take you through the process of modifying XML with both XmlDocument as well as XDocument. We will continue to use the library XML in this chapter and will also assume that all the XML has been loaded into an instantiated XmlDocument or XDocumentnamed document. As a reminder, following is the library XML:

<?xml version="1.0"?><library>        <books>                <book checkedout="no">                        <title>To ...

Get C# and XML Primer 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.