Share via


2.3 DiffGram XML Structure

A valid DataSet DiffGram structure MUST conform to the following rules:

  • The DiffGram MUST have a root element, hereafter referred to as the <root> element.

  • If the <root> element contains at least one <schema> element as specified in [XMLSCHEMA2], the following rules MUST apply:

    • If the <root> element does not contain one or more <schema> elements, the schema is assumed to be predefined between the producer and consumer.

    • If the <root> element contains a <diffgr:diffgram> element, hereafter referred to as the DiffGram Data element, the <root> element MUST be a <diffgram> element as defined in the namespace urn:schemas-microsoft-com:xml-diffgram-v1. If the DiffGram Data element is not specified, the consumer MUST assume that the data is empty.

  • The XML that comprises a DiffGram Data element MUST include required XML elements and XML attributes as specified in the following sections of this document. These XML elements and XML attributes are defined in various XML namespaces. The following table lists these XML namespaces and specifies the XML namespace prefixes that are commonly associated with them. Producers and consumers of DataSet DiffGram structures MUST ensure that the XML references these namespaces by using the mechanisms that are specified in [XMLNS], but they SHOULD<1> use the prefixes that are shown in the following table. For clarity, when XML elements and attributes from these namespaces are referenced in this document, their fully-qualified names are used.

    Description

    Namespace URI

    Commonly used prefix

    Reference

    XML Schema elements and attributes

    http://www.w3.org/2001/XMLSchema

    xs

    [XMLSCHEMA1]

    [XMLSCHEMA2]

    DiffGram elements and attributes

    urn:schemas-microsoft-com:xml-diffgram-v1diffgr

    diffgr

    This namespace is internal to the DiffGram structure and is described in section 2.3.2.

    DataSet specific annotations

    urn:schemas-microsoft-com:xml-msdata

    msdata

    [MC-ADONETDSSS]

    DataSet extended properties

    urn:schemas-microsoft-com:xml-msprop

    msprop

    User and application-specific information can be annotated on the DataSet schema with extended properties. The extended properties are defined in this namespace.

The sections that follow define the <schema> elements and the DiffGram Data element in more detail. At a basic level, the purpose of these elements can be explained as follows:

  • The DiffGram <schema> elements define the XML Schema that is specified in [XMLSCHEMA1] and [XMLSCHEMA2], which is a representation of the structure of the data that is contained in the DiffGram Data element. The DiffGram <schema> elements are then mapped to DataSet concepts.

  • The DiffGram Data element encapsulates the values of the data in the DataSet.