Using XML in the .NET Framework "  Chapter 4 145 The XmlDataDocument is used in this case simply to get a good amount of data to work with without needing to have an XML document on hand. Loading an XML document using the XmlDocument instead of the XmlDataDocument would be a very minor change, and would simply involve changing the way you load the XML.The rest would be exactly the same. After weve retrieved the XmlDataDocument, we call the GetElementsByTagName method and choose to retrieve every Table element in the XML. Next, we loop through the XmlNodeList, writing out the pertinent information on every node that appears in the list. As you can see, there isnt that much to the XmlNodeList, since it is essentially nothing but a list class, like the list classes in the System.Collections  namespace. Using the System.Xml Namespace This section of the chapter provides you with a thorough example of how to use the System.Xml namespace and the classes in this namespace.This exercise will show you how to create and load an XML document using the XmlDocument class, select multiple and single nodes in the document, edit node values, delete nodes, and finally, save the XML document to the file system. The exercise you are about to read is a simple address book using XML as the data store.The address book will store a list of categories and a list of cate- gory entries associated with individual categories. It will have the capabilities to handle multiple address books using multiple XML files, create the base XML files automatically, and be able to add, edit, and remove nodes using the DOM- compliant System.Xml classes. Building the XML Address Book The XML Address Book is a C# Windows application that can be found at in the XmlAddressBook folder. It uses three forms to accept user input and to display your address book grouped by categories. When you select a category, it displays the associated entries, and when you select an entry it displays the entry information and allows you to update the entry you selected. See Figure 4.16 for a screenshot of the user interface of the application. Loading the XML Address Book The first step in creating your address book is to define the format of your XML data. In this case, weve already seen the format of the XML in Figure 4.1 earlier 155_xml_net_pd_C04.qk  3/6/02  1:57 PM  Page 145