Share via


2.3.2 DiffGram Data Element

Conceptually, the DiffGram Data element encapsulates the XML representation of the data in the DataSet object. At a high-level, the DiffGram Data element contains the following child elements:

  • A DataInstance element's rows, and the data that they contain, MUST conform to the rules that are specified in sections 2.1 and 2.2.

  • A <urn:schemas-microsoft-com:xml-diffgram-v1:before> element (hereafter referred to as the "<before> element").

  • A <urn:schemas-microsoft-com:xml-diffgram-v1:errors> element (hereafter referred to as the "<errors> element").

This high-level structure is defined by the following XSD.

 <?xml version="1.0" standalone="yes"?>
 <xs:schema targetNamespace="urn:schemas-microsoft-com:xml-diffgram-v1" xmlns="urn:schemas-microsoft-com:xml-diffgram-v1" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop" attributeFormDefault="qualified" elementFormDefault="qualified">
 <xs:import namespace="urn:schemas-microsoft-com:xml-msdata"/>
   <xs:attribute name="id" type="xs:string"/>
 <xs:attribute name="hasChanges">
   <xs:simpleType>
     <xs:restriction base="xs:string">
       <xs:enumeration value="Inserted"/>
       <xs:enumeration value="Modified"/>
     </xs:restriction>
   </xs:simpleType>
   </xs:attribute>
   <xs:attribute name="hasErrors" type="xs:boolean"/>
   <xs:attribute name="Error" type="xs:string"/>
   <xs:element name="diffgram">
     <xs:complexType>
       <xs:sequence minOccurs="0" maxOccurs="1">
         <xs:any namespace="##other" processContents="lax" minOccurs="0" />
         <xs:element name="before" minOccurs="0">
           <xs:complexType>
             <xs:choice maxOccurs="unbounded">
               <xs:any namespace="##other" processContents="lax" minOccurs="0"/>
             </xs:choice>
           </xs:complexType>
         </xs:element>
         <xs:element name="errors" minOccurs="0">
           <xs:complexType>
             <xs:choice maxOccurs="unbounded">
               <xs:any namespace="##other" processContents="lax" minOccurs="0"/>              
             </xs:choice>
           </xs:complexType>
         </xs:element>
       </xs:sequence>
     </xs:complexType>
   </xs:element>
 </xs:schema>

In the preceding XSD, the following are the definitions of the DiffGram Data element, the DataInstance element, the <before> element, and the <errors> element.

   <xs:element name="diffgram">
         <xs:any namespace="##other" processContents="lax" minOccurs="0" />
         <xs:element name="before" minOccurs="0">
         <xs:element name="errors" minOccurs="0">

Note that because the schema of the DataInstance element is defined by the <schema> element of the DiffGram (and varies per DataSet), it is not possible to write a single schema for the DiffGram Data element that properly defines the DataInstance element. Therefore, the preceding schema allows any content in the place of the DataInstance element. Producers and consumers of DiffGrams MUST make sure that the DataInstance element's rows, and the data they contain, MUST conform to the rules that are specified in sections 2.1 and 2.2 and 2.3.

The sub-sections that follow define the parts of the DiffGram Data element in more detail.