
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
831
Chapter 15
CHAPTER 15
XML
15.0 Introduction
Extensible Markup Language (XML) is a simple, portable, and flexible way to repre-
sent data in a structured format. XML is used in a myriad of ways, from acting as the
foundation of web-based messaging protocols such as SOAP, to being one of the
more popular ways to store configuration data (such as the web.config, machine.
config,orsecurity.config files in the .NET Framework). Microsoft recognized the use-
fulness of XML to developers and has done a nice job of giving you choices concern-
ing the trade-offs involved. Sometimes you want to simply run though an XML
document looking for a value in a read-only cursorlike fashion, and other times you
need to be able to randomly access various pieces of the document. Microsoft pro-
vides classes like
XmlReader and XmlWriter for lighter access and XmlDocument for full
Document Object Model (DOM) processing support. In the 1.x versions of the
Framework, the
XmlTextReader, XmlTextWriter, and XmlValidatingReader classes were
provided as concrete instances to be used. Microsoft is now recommending using the
factory methods on the
XmlReader and XmlWriter classes, in conjunction with the
XmlReaderSettings and XmlWriterSettings classes to work with XML.
It is likely that you will be dealing with XML in