O'Reilly logo

Professional C# 4 and .NET 4 by Morgan Skinner, Karli Watson, Jay Glynn, Bill Evjen, Christian Nagel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 33. Manipulating XML

WHAT'S IN THIS CHAPTER?

  • XML standards

  • XmlReader and XmlWriter

  • XmlDocument

  • XPathDocument

  • XmlNavigator

  • LINQ to XML

  • Working with objects in the System.Xml.Linq namespace

  • Querying XML documents using LINQ

  • Using LINQ to SQL and LINQ to XML together

XML plays a significant role in the .NET Framework. Not only does the .NET Framework allow you to use XML in your application, but the .NET Framework itself uses XML for configuration files and source code documentation, as do SOAP, web services, and ADO.NET, to name just a few.

To accommodate this extensive use of XML, the .NET Framework includes the System.Xml namespace. This namespace is loaded with classes that can be used for the processing of XML, and many of these classes are discussed in this chapter.

This chapter discusses how to use the XmlDocument class, which is the implementation of the Document Object Model (DOM), as well as what .NET offers as a replacement for SAX (the XmlReader and XmlWriter classes). It also discusses the class implementations of XPath and XSLT and demonstrates how XML and ADO.NET work together, as well as how easy it is to transform one to the other. You also learn how you can serialize your objects to XML and create an object from (or deserialize) an XML document by using classes in the System.Xml.Serialization namespace. More to the point, you learn how you can incorporate XML into your C# applications.

You should note that the XML namespace allows you to get similar results in a number ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required