138 Chapter 4 " Using XML in the .NET Framework <NewDataSet> <Table> <au_id>172-32-1176</au_id> <au_lname>White</au_lname> <au_fname>Johnson</au_fname> <phone>408 496-7223</phone> <address>10932 Bigge Rd.</address> <city>Menlo Park</city> <state>CA</state> <zip>94025</zip> <contract>true</contract> </Table> </NewDataSet> As you can see, the XmlDataDocument can be a very valuable addition for those of us who want to turn our relational data into a readable XML format.When working with ADO in the pre-.NET era, turning a RecordSet into XML and then attempting to read the resulting XML was something only the bravest or most igno- rant did.The only thing you could really do with the resulting XML is save it to the www.syngress.com Deciding Which Class to Use to Represent Your XML Data The System.Xml namespace provides a number of classes that represent XML documents, and deciding what to use and how to use it should be a design consideration. The XmlDocument class is available for access to a text-based set of XML data. If you have XML passed to your class as a param- eter, or you are able to directly access an XML document on a file system, then the XmlDocument class is definitely the correct choice. If you have a streaming model to your XML data, then the XmlTextReader might be a good class to use to access the streaming data. If you are receiving XML from a database, then the XmlDataDocument would be a good choice, although you do have several methods from which to choose to retrieve this data (ExecuteReader returns an XmlReader, the SQLXML classes allow use of the FOR XML clause in SQL statements) when using this method. Designing & Planning& 155_xml_net_pd_C04.qk 3/6/02 1:57 PM Page 138