XSD
The following describes the schema in XML Schema definition language (XSD) form:
<?xml version='1.0' ?>
<Schema name='fetch-schema' xmlns='urn:schemas-microsoft-com:xml-data'
xmlns:dt='urn:schemas-microsoft-com:datatypes'>
<!--
condition element - used for capturing entity and link-entity
"where" clause criteria
-->
<ElementType name='value' content='textOnly' model='closed' />
<ElementType name='condition' content='eltOnly' model='closed'>
<AttributeType name='attribute' dt:type='string' required='yes' />
<AttributeType name='operator' dt:type='enumeration'
dt:values='lt gt le ge eq ne null not-null in not-in between
not-between like not-like yesterday today tomorrow
next-seven-days last-seven-days next-week last-week this-month
last-month next-month on on-or-before on-or-after this-year
last-year next-year eq-userid ne-userid eq-businessid
ne-businessid' required='yes' default='eq' />
<AttributeType name='value' dt:type='string' required='no' />
<AttributeType name='aggregate' dt:type='enumeration'
dt:values='count' required='no' />
<AttributeType name='alias' dt:type='string' required='no' />
<!-- -->
<attribute type='attribute' />
<attribute type='operator' />
<!--
The attribute "value" is used for all operators that need to compare
against a single value (such as eq).
The element "value" is used for operators that need to compare
against multiple values (such as in).
Some operators require neither the attribute "value" or the element
"value" (such as null).
-->
<attribute type='value' />
<attribute type='aggregate' />
<attribute type='alias' />
<element type='value' minOccurs='0' maxOccurs='*' />
</ElementType>
<!--
filter element - used for constructing complex conditionals
legal one entity and link-entity
-->
<ElementType name='filter' content='eltOnly' model='closed'>
<AttributeType name='type' dt:type='enumeration'
dt:values='and or' required='no' default='and' />
<!-- -->
<attribute type='type' />
<element type='condition' minOccurs='0' maxOccurs='*' />
<element type='filter' minOccurs='0' maxOccurs='*' />
</ElementType>
<!--
attribute elements - used for selecting attributes from the
surrounding entity / link-entity, these values are returned
as part of the fetch
-->
<ElementType name='all-attributes' content='empty' model='closed' />
<ElementType name='attribute' content='empty' model='closed'>
<AttributeType name='name' dt:type='string' required='yes' />
<!-- -->
<attribute type='name' />
</ElementType>
<!--
order element - used to specify a sort order
-->
<ElementType name='order' content='eltOnly' model='closed'>
<AttributeType name='attribute' dt:type='string' required='yes' />
<AttributeType name='descending'
dt:type='boolean' required='no' default='false' />
<!-- -->
<attribute type='attribute' />
<attribute type='descending' />
</ElementType>
<!--
link-entity element - used for joining one entity to it's "parent"
-->
<ElementType name='link-entity' content='eltOnly'
model='closed' order='many'>
<AttributeType name='to' dt:type='string' required='no' />
<AttributeType name='from' dt:type='string' required='no' />
<AttributeType name='name' dt:type='string' required='yes' />
<AttributeType name='alias' dt:type='string' required='no' />
<AttributeType name='link-type' dt:type='string'
dt:values='natural inner outer' required='no' />
<!-- -->
<attribute type='name' />
<attribute type='to' />
<attribute type='alias' />
<attribute type='link-type' />
<element type='all-attributes' minOccurs='0' maxOccurs='1' />
<element type='attribute' minOccurs='0' maxOccurs='*' />
<element type='order' minOccurs='0' maxOccurs='*' />
<element type='filter' minOccurs='0' maxOccurs='1' />
<element type='link-entity' />
</ElementType>
<!--
entity element - used for specifying the root element for a fetch,
only one root entity is allowed in a given fetch, all others
are dependent on this entity and are marked as link-entity
-->
<ElementType name='entity' content='eltOnly'
model='closed' order='many'>
<AttributeType name='name' dt:type='string' required='yes' />
<!-- -->
<attribute type='name' />
<element type='all-attributes' minOccurs='0' maxOccurs='1' />
<element type='attribute' minOccurs='0' maxOccurs='*' />
<element type='order' minOccurs='0' maxOccurs='*' />
<element type='link-entity' />
<element type='filter' minOccurs='0' maxOccurs='1' />
</ElementType>
<!--
fetch element - root element for the query
-->
<ElementType name='fetch' content='eltOnly' model='closed'>
<AttributeType name='count' dt:type='int' required='no' />
<AttributeType name='page' dt:type='int' required='no' />
<AttributeType name='utc-offset' dt:type='int' required='no' />
<AttributeType name='aggregate' dt:type='boolean' required='no' />
<AttributeType name='mapping' dt:type='enumeration'
dt:values='internal logical physical' required='no' />
<!-- -->
<attribute type='count' />
<attribute type='page' />
<attribute type='utc-offset' />
<attribute type='aggregate' />
<attribute type='mapping' />
<element type='entity' minOccurs='1' maxOccurs='1' />
</ElementType>
</Schema>