Chapter 2. Reading XML
Perhaps
the simplest thing you can do with an existing XML document is to
read it into memory. The .NET Framework provides a set of tools in
the System.Xml namespace to help you read XML,
whether you wish to deal with it as a stream of events or to load the
data into your own data structures. In this chapter we take a look at
XmlReader, its subclasses, and the associated .NET
types and interfaces. I also discuss when it is appropriate to use
the XmlReader instead of other methods of reading
XML, and describe the differences between pull parsers and push
parsers.
You can read XML from a local file or from a remote source over a
network. You'll see how to deal with various local
and remote inputs, including reading through a network proxy. And
you'll learn how to validate an XML document
regardless of which sort of input source is used.
Throughout this chapter, I make use of a hypothetical Angus Hardware
purchase order in XML and do some simple processing of its contents.
|