Reading and Writing XML Data
First let’s examine the different ways we can read and write XML data using the DataSet class.
The DataSet Class’s XML Methods
The DataSet class has a series of methods that let you examine its contents as XML, as well as load XML data into the DataSet.
The simplest of these XML methods is the GetXml method, which you can use to extract the contents of your DataSet and place them into a string. The GetXml method is simple, almost to a fault. It is not overloaded and accepts no parameters.
Figure 12-1 shows the contents of a DataSet in the Console window. The code that generates and displays this DataSet follows. The code snippet retrieves orders and line items for a customer using a function we’ll reuse in ...