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.
GetXml Method
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 ...
Get Programming Microsoft® ADO.NET 2.0 Core Reference, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.