Chapter 5. Manipulating XML with DOM
The first section of this book laid the groundwork for your XML education by showing you how to read and write XML and other data using the .NET Framework. In between reading and writing, however, you’ll often need to work with the data in other ways. This section will introduce various W3C standards and the implementations of those standards in the .NET Framework.
XmlReader allows you to access XML data in a
read-only, forward-only manner, but sometimes you need to read XML in
a non-sequential manner. For example, you may want to change the
order of a couple of elements somewhere in the middle of the document
tree. For this purpose, the World Wide Web Consortium developed the
Document Object Model (DOM).
In this chapter, I’ll discuss what the DOM is, how .NET implements it, and when it is appropriate to use the DOM in your own code. Finally, we’ll look at some examples using the DOM in C#.