Data Component XSD

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
  attributeFormDefault="unqualified">
  <xs:element name="DataComponent">
    <xs:annotation>
      <xs:documentation>Defines a templateComponent that encapsulates a set or subset of data.</xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence maxOccurs="unbounded">
        <xs:element maxOccurs="unbounded" minOccurs="0" name="Option">
          <xs:complexType>
            <xs:attribute name="Name" type="xs:string" use="required"/>
            <xs:attribute name="Value" type="xs:string" use="required"/>
          </xs:complexType>
        </xs:element>
        <xs:element form="qualified" maxOccurs="unbounded" minOccurs="0" name="SetUp">
          <xs:annotation>
            <xs:documentation>Runs a block of SQL before data is extracted and/or deployed to setup any additional resources required to support the data templateComponent.</xs:documentation>
          </xs:annotation>
          <xs:complexType mixed="true">
            <xs:attribute default="true" name="BuildTime" type="xs:boolean">
              <xs:annotation>
                <xs:documentation>Runs the SQL block when generating the script if the attrribute is set to true.</xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute default="true" name="DeployTime" type="xs:boolean">
              <xs:annotation>
                <xs:documentation>Runs the SQL block when deploying the script if the attrribute is set to true.</xs:documentation>
              </xs:annotation>
            </xs:attribute>
          </xs:complexType>
        </xs:element>
        <xs:element maxOccurs="unbounded" minOccurs="0" name="TempTable">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="Column" maxOccurs="unbounded" minOccurs="1">
                <xs:complexType>
                  <xs:attribute name="Name" use="required" type="xs:string"/>
                  <xs:attribute name="DataType" type="xs:string" use="required"/>
                  <xs:attribute name="Length" type="xs:int"/>
                  <xs:attribute name="Precision" type="xs:int"/>
                  <xs:attribute name="Scale" type="xs:int"/>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="Name" type="xs:string" use="required"/>
          </xs:complexType>
        </xs:element>
        <xs:element name="Table" maxOccurs="unbounded">
          <xs:complexType>
            <xs:sequence>
              <xs:element maxOccurs="unbounded" minOccurs="0" name="Option">
                <xs:complexType>
                  <xs:attribute name="Name" type="xs:string" use="required"/>
                  <xs:attribute name="Value" type="xs:string" use="required"/>
                </xs:complexType>
              </xs:element>
              <xs:element name="Column" type="TableColumnType" maxOccurs="unbounded" minOccurs="0"/>
              <xs:element name="JoinTable" maxOccurs="unbounded" minOccurs="0">
                <xs:complexType>
                  <xs:sequence minOccurs="0">
                    <xs:element maxOccurs="unbounded" name="JoinColumn">
                      <xs:complexType>
                        <xs:attribute name="Column" type="xs:string" use="required"/>
                        <xs:attribute name="ReferenceColumn" type="xs:string" use="required"/>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                  <xs:attribute name="ReferenceId" type="xs:int" use="required"/>
                  <xs:attribute name="Relationship" type="RelationshipTypeEnum"/>
                  <xs:attribute default="false" name="FilterOnly" type="xs:boolean"/>
                </xs:complexType>
              </xs:element>
              <xs:element minOccurs="0" name="Filters">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element maxOccurs="unbounded" minOccurs="0" name="Value">
                      <xs:complexType>
                        <xs:attribute name="Column" type="xs:string" use="required"/>
                        <xs:attribute name="Value" type="xs:string" use="optional"/>
                        <xs:attribute name="Operator" type="OperatorEnum" use="optional"
                          default="eq"/>
                        <xs:attribute name="DataType" type="xs:string" use="optional"/>
                        <xs:attribute name="Length" type="xs:int"/>
                        <xs:attribute name="Precision" type="xs:int"/>
                        <xs:attribute name="Scale" type="xs:int"/>
                      </xs:complexType>
                    </xs:element>
                    <xs:element maxOccurs="unbounded" minOccurs="0" name="SubQuery">
                      <xs:complexType mixed="true">
                        <xs:attribute name="Column" type="xs:string" use="required"/>
                      </xs:complexType>
                    </xs:element>
                    <xs:element form="qualified" maxOccurs="unbounded" minOccurs="0" name="Exists">
                      <xs:complexType mixed="true">
                        <xs:attribute default="false" name="NotExists" type="xs:boolean"/>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="Id" type="xs:int" use="required"/>
            <xs:attribute name="Name" use="required" type="xs:string">
              <xs:annotation>
                <xs:documentation>The name of the table containing data to be
                  extracted.</xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="Schema" use="optional" type="xs:string">
              <xs:annotation>
                <xs:documentation>The schema to which the table belongs, only required if it is
                  different to the default schema and/or the data templateComponent
                  schema.</xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute default="true" name="InsertEnabled" type="xs:boolean">
              <xs:annotation>
                <xs:documentation>If set to true it will include the insert Operation.</xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute default="true" name="UpdateEnabled" type="xs:boolean">
              <xs:annotation>
                <xs:documentation>If set to true it will include the update Operation.</xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="DeleteEnabled" type="xs:boolean">
              <xs:annotation>
                <xs:documentation>If set to true it will include the delete Operation.</xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute name="Alias" type="xs:string"/>
            <xs:attribute default="true" name="PrimaryKeyMerge" type="xs:boolean"/>
          </xs:complexType>
        </xs:element>
        <xs:element maxOccurs="unbounded" minOccurs="0" name="TearDown">
          <xs:annotation>
            <xs:documentation>Runs a block of SQL after data is extracted and/or deployed to tear
              down any additional resources created to support the data
              templateComponent.</xs:documentation>
          </xs:annotation>
          <xs:complexType mixed="true">
            <xs:attribute default="true" name="BuildTime" type="xs:boolean">
              <xs:annotation>
                <xs:documentation>Runs the SQL block when generating the script if the attrribute is
                  set to true.</xs:documentation>
              </xs:annotation>
            </xs:attribute>
            <xs:attribute default="true" name="DeployTime" type="xs:boolean">
              <xs:annotation>
                <xs:documentation>Runs the SQL block when deploying the script if the attrribute is
                  set to true.</xs:documentation>
              </xs:annotation>
            </xs:attribute>
          </xs:complexType>
        </xs:element>
        <xs:element maxOccurs="unbounded" minOccurs="0" name="DynamicQuery" nillable="false"
          type="xs:string">
          <xs:annotation>
            <xs:documentation>The dynamic query creates a templateComponent record for each row of data by
              applying variable substitutions using the column names returned in the query. In this
              way a definition can generate multiple templateComponents from a single
              definition.</xs:documentation>
          </xs:annotation>
        </xs:element>
        <xs:element form="qualified" maxOccurs="unbounded" minOccurs="0" name="Reference"
          nillable="false">
          <xs:complexType mixed="true">
            <xs:attribute name="Id" use="required" type="xs:string"/>
            <xs:attribute name="Variable" type="xs:string" use="required"/>
          </xs:complexType>
        </xs:element>
        <xs:element minOccurs="0" name="Deployment">
          <xs:complexType>
            <xs:sequence>
              <xs:element maxOccurs="unbounded" minOccurs="0" name="Script">
                <xs:complexType>
                  <xs:attribute name="Path" type="xs:string" use="required"/>
                  <xs:attribute name="Weight" type="xs:string" use="required"/>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="Weight" type="xs:int" use="required"/>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
      <xs:attribute name="Schema" use="optional" type="xs:string"/>
      <xs:attribute name="Category" use="required" type="xs:string"/>
      <xs:attribute name="Name" use="required" type="xs:string"/>
      <xs:attribute default="true" name="DeleteEnabled" type="xs:boolean">
        <xs:annotation>
          <xs:documentation>If set to true it will include delete clauses to remove rows during
            deployment where the target set constains rows that are not in the source
            subset.</xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="GttSchema" type="xs:string"/>
      <xs:attribute name="GttActionColumn" type="xs:string"/>
    </xs:complexType>
  </xs:element>
  <xs:complexType name="TableColumnType">
    <xs:sequence minOccurs="0">
      <xs:choice>
        <xs:element minOccurs="1" ref="Lookup" maxOccurs="unbounded"/>
        <xs:element name="XmlColumn">
          <xs:complexType>
            <xs:sequence>
              <xs:element maxOccurs="unbounded" minOccurs="0" name="Option">
                <xs:complexType>
                  <xs:attribute name="Name" type="xs:string" use="required"/>
                  <xs:attribute name="Value" type="xs:string" use="required"/>
                </xs:complexType>
              </xs:element>
              <xs:element maxOccurs="unbounded" minOccurs="0" ref="Xpath"/>
            </xs:sequence>
            <xs:attribute name="Declaration" type="xs:string"/>
          </xs:complexType>
        </xs:element>
      </xs:choice>
    </xs:sequence>
    <xs:attribute name="Name" use="required" type="xs:string"/>
    <xs:attribute name="PrimaryKey" type="xs:boolean"/>
    <xs:attribute name="AlternativeKey" type="xs:boolean"/>
    <xs:attribute name="InsertExclude" type="xs:boolean"/>
    <xs:attribute name="UpdateExclude" type="xs:boolean"/>
    <xs:attribute default="true" name="UpdateTrigger" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>Set to false to avoid differences on the column triggering an update i.e.
          on an "UpdatedBy" Column.</xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="CurrentDate" type="CurrentDateTypeEnum">
      <xs:annotation>
        <xs:documentation>Set to ture to if uodates or inserts should use the current time.
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="Value" type="xs:string"/>
    <xs:attribute name="Default" type="xs:string"/>
    <xs:attribute name="Increment" type="xs:integer"/>
    <xs:attribute name="Transient" type="xs:boolean" use="optional"/>
    <xs:attribute name="Generator" type="xs:string"/>
    <xs:attribute name="CaseSensitive" type="xs:boolean" use="optional"/>
    <xs:attribute name="DataType" type="xs:string"/>
    <xs:attribute name="Length" type="xs:int"/>
    <xs:attribute name="Precision" type="xs:int"/>
    <xs:attribute name="Scale" type="xs:int"/>
    <xs:attribute name="Include" type="xs:boolean"/>
    <xs:attribute name="SortOrder" type="xs:int"/>
    <xs:attribute name="SortDirection" type="SortDirectionTypeEnum"/>
    <xs:attribute name="Collation" type="xs:string"/>
  </xs:complexType>
  <xs:element name="Lookup">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Criteria" maxOccurs="unbounded" minOccurs="1">
          <xs:complexType>
            <xs:attribute name="Column" use="required" type="xs:string"/>
            <xs:attribute name="Length" type="xs:int"/>
          </xs:complexType>
        </xs:element>
        <xs:element minOccurs="0" name="Filters">
          <xs:complexType>
            <xs:sequence>
              <xs:element maxOccurs="unbounded" minOccurs="0" name="Value">
                <xs:complexType>
                  <xs:attribute name="Column" type="xs:string" use="required"/>
                  <xs:attribute name="Operator" type="OperatorEnum" use="optional" default="eq"/>
                  <xs:attribute name="Value" type="xs:string" use="optional"/>
                  <xs:attribute name="DataType" type="xs:string" use="optional"/>
                  <xs:attribute name="Length" type="xs:int"/>
                  <xs:attribute name="Precision" type="xs:int"/>
                  <xs:attribute name="Scale" type="xs:int"/>
                </xs:complexType>
              </xs:element>
              <xs:element maxOccurs="unbounded" minOccurs="0" name="SubQuery">
                <xs:complexType mixed="true">
                  <xs:attribute name="Column" type="xs:string" use="required"/>
                  <xs:attribute name="Operator" type="OperatorEnum" use="optional" default="in"/>
                  <xs:attribute name="DataType" type="xs:string" use="optional"/>
                  <xs:attribute name="Length" type="xs:int"/>
                  <xs:attribute name="Precision" type="xs:int"/>
                  <xs:attribute name="Scale" type="xs:int"/>
                </xs:complexType>
              </xs:element>
              <xs:element form="qualified" maxOccurs="unbounded" minOccurs="0" name="Exists">
                <xs:complexType mixed="true">
                  <xs:attribute default="false" name="NotExists" type="xs:boolean"/>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element minOccurs="0" name="WhenNotFound">
          <xs:complexType>
            <xs:sequence>
              <xs:element maxOccurs="unbounded" minOccurs="0" name="IgnoreValue" type="xs:string"/>
            </xs:sequence>
            <xs:attribute name="Action" type="ValidationTypeEnum" use="required"/>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
      <xs:attribute name="Column" use="required" type="xs:string"/>
      <xs:attribute name="Table" use="required" type="xs:string"/>
      <xs:attribute name="Prefix" type="xs:string"/>
      <xs:attribute name="Suffix" type="xs:string"/>
      <xs:attribute name="Type" type="xs:string"/>
      <xs:attribute name="Inner" default="true" type="xs:boolean"> </xs:attribute>
      <xs:attribute name="Transient" default="true" type="xs:boolean"/>
      <xs:attribute name="Schema" type="xs:string"/>
      <xs:attribute name="ReferenceId" type="xs:string"/>
      <xs:attribute name="Length" type="xs:integer"/>
      <xs:attribute name="Precision" type="xs:int"/>
      <xs:attribute name="Scale" type="xs:int"/>
    </xs:complexType>
  </xs:element>
  <xs:simpleType name="OperatorEnum">
    <xs:restriction base="xs:string">
      <xs:enumeration value="gt"/>
      <xs:enumeration value="ge"/>
      <xs:enumeration value="lt"/>
      <xs:enumeration value="le"/>
      <xs:enumeration value="eq"/>
      <xs:enumeration value="ne"/>
      <xs:enumeration value="numeric"/>
      <xs:enumeration value="like"/>
      <xs:enumeration value="in"/>
      <xs:enumeration value="notin"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="ElementTypeEnum">
    <xs:restriction base="xs:string">
      <xs:enumeration value="Attribute"/>
      <xs:enumeration value="Element"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="OnOffTypeEnum">
    <xs:restriction base="xs:string">
      <xs:enumeration value="On"/>
      <xs:enumeration value="Off"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="ValidationTypeEnum">
    <xs:restriction base="xs:string">
      <xs:enumeration value="None"/>
      <xs:enumeration value="Warn"/>
      <xs:enumeration value="Error"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="RelationshipTypeEnum">
    <xs:restriction base="xs:string">
      <xs:enumeration value="OneToMany"/>
      <xs:enumeration value="OneToOne"/>
      <xs:enumeration value="ManyToOne"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="CurrentDateTypeEnum">
    <xs:restriction base="xs:string">
      <xs:enumeration value="Date"/>
      <xs:enumeration value="Time"/>
      <xs:enumeration value="DateTime"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="SortDirectionTypeEnum">
    <xs:restriction base="xs:string">
      <xs:enumeration value="Asc"/>
      <xs:enumeration value="Desc"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:element name="Xpath">
    <xs:complexType>
      <xs:choice>
        <xs:element ref="Lookup" maxOccurs="unbounded"/>
        <xs:element ref="Xpath" maxOccurs="unbounded"/>
      </xs:choice>
      <xs:attribute name="Type" use="required">
        <xs:simpleType>
          <xs:restriction base="ElementTypeEnum"/>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute name="Select" type="xs:string" use="required"/>
      <xs:attribute name="Declaration" type="xs:string" use="optional"/>
    </xs:complexType>
  </xs:element>
</xs:schema>