XML DataSet•Persist Large DataSets to XML Files for Offline Editing

Listing C. Saving the dsCusts DataSet to an XML file creates the document structure shown here. This file, which weighs in at about 10 MB for 25,000 customers, creates a new DataSet when users start a session. Loading time with a fast processor and Ultra-ATA disk drive is about five seconds (see Table 1).

<?xml version="1.0" standalone="yes"?>
<NewDataSet>
   <xs:schema id="NewDataSet" xmlns="" 
         xmlns:xs="http://www.w3.org/2001/XMLSchema" 
         xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
      <xs:element name="NewDataSet" msdata:IsDataSet="true">
         <xs:complexType>
            <xs:choice maxOccurs="unbounded">
               <xs:element name="Customers" >
                  <xs:complexType>
                     <xs:sequence>
                        <xs:element name="CustID" type="xs:int" 
                              minOccurs="0" />
                        <xs:element name="FirstName" 
                              type="xs:string" minOccurs="0" />
                        <xs:element name="LastName" 
                              type="xs:string" minOccurs="0" />
                        <xs:element name="Address" 
                              type="xs:string" minOccurs="0" />
                        <xs:element name="City" 
                              type="xs:string" minOccurs="0" />
                        <xs:element name="State" 
                              type="xs:string" minOccurs="0" />
                        <xs:element name="ZIPCode" 
                              type="xs:string" minOccurs="0" />
                        <xs:element name="Phone" 
                              type="xs:string" minOccurs="0" />
                        <xs:element name="Email" 
                              type="xs:string" minOccurs="0" />
                        <xs:element name="PreferredCust" 
                              type="xs:boolean" minOccurs="0" />
                        <xs:element name="Modified" 
                              type="xs:dateTime" minOccurs="0" />
                     </xs:sequence>
                  </xs:complexType>
               </xs:element>
            </xs:choice>
         </xs:complexType>
      </xs:element>
   </xs:schema>
   <Customers>
      <CustID>1000001</CustID>
      <FirstName>Heather</FirstName>
      <LastName>Sowanick</LastName>
      <Address>385 Mimosa Dr</Address>
      <City>Saint Louis</City>
      <State>MO</State>
      <ZIPCode>63121-2517</ZIPCode>
      <Phone>714-896-0000</Phone>
      <Email>heatherso@aol.com</Email>
      <PreferredCust>false</PreferredCust>
      <Modified>2004-03-19T08:35:06.3200000-08:00</Modified>
   </Customers>
   <!-- 25,371 customers omitted for brevity -->
   <Customers>
      <CustID>1025373</CustID>
      <FirstName>Albert</FirstName>
      <LastName>Kang</LastName>
      <Address>1203 Spruce St</Address>
      <City>Houston</City>
      <State>TX</State>
      <ZIPCode>77096-1306</ZIPCode>
      <Phone>713-359-6868</Phone>
      <Email>albertrka@hotmail.com</Email>
      <PreferredCust>false</PreferredCust>
      <Modified>2004-03-28T07:38:52.4070000-08:00</Modified>
   </Customers>
</NewDataSet>