<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.culture.gouv.fr/ns/sdx/sdx" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:sdx="http://www.culture.gouv.fr/ns/sdx/sdx" xmlns:xsp="http://apache.org/xsp" elementFormDefault="qualified" attributeFormDefault="unqualified">
    <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml.xsd"/>
    <xs:import namespace="http://apache.org/xsp" schemaLocation="xsp.xsd"/>
    <xs:annotation>
        <xs:documentation>
    Schema for sdx:actions and parameters, used in cocoon-xsp context.
    
    TODO : refactoring with abstract elements and inherited types
        </xs:documentation>
    </xs:annotation>
    <!--
     |    ELEMENTS
     |-->
    <xs:group name="external">
        <xs:choice>
            <xs:any namespace="##other" processContents="strict"/>
            <!-- avoid any for precise validation,
             better is to precise your own namespaces
            <xs:any/>
            <xs:any namespace="http://apache.org/xsp" processContents="strict"/>
            <xs:any namespace="http://apache.org/cocoon/include/1.0" processContents="strict"/>
            -->
        </xs:choice>
    </xs:group>
    <!-- root -->
    <xs:element name="page" type="sdx:page"/>
    <!-- flow -->
    <xs:element name="flow" type="sdx:flow" abstract="true"/>
    <xs:element name="debug" substitutionGroup="sdx:flow" type="sdx:flow"/>
    <xs:element name="comment" substitutionGroup="sdx:flow" type="sdx:flow"/>
    <xs:element name="success" substitutionGroup="sdx:flow" type="sdx:flow"/>
    <xs:element name="fallback" substitutionGroup="sdx:flow" type="sdx:flow"/>
    <!-- rights -->
    <xs:element name="rights" abstract="true" type="sdx:rights"/>
    <xs:element name="login" type="sdx:rights" substitutionGroup="sdx:rights"/>
    <xs:element name="loginSu" type="sdx:rights" substitutionGroup="sdx:rights"/>
    <xs:element name="userIsMember" type="sdx:rights" substitutionGroup="sdx:rights"/>
    <xs:element name="userIsAdmin" type="sdx:rights" substitutionGroup="sdx:rights"/>
    <xs:element name="userIsSu" type="sdx:rights" substitutionGroup="sdx:rights"/>
    <xs:element name="userIsAdminOrSu" type="sdx:rights" substitutionGroup="sdx:rights"/>
    <!-- action -->
    <xs:element name="action" type="sdx:action" abstract="true"/>
    <!-- execute -->
    <xs:element name="execute" abstract="true" type="sdx:execute" substitutionGroup="sdx:action"/>
    <xs:element name="executeSimpleQuery" type="sdx:executeSimpleQuery" substitutionGroup="sdx:execute"/>
    <xs:element name="executeFieldQuery" type="sdx:executeFieldQuery" substitutionGroup="sdx:execute"/>
    <xs:element name="executeListQuery" type="sdx:executeListQuery" substitutionGroup="sdx:execute"/>
    <xs:element name="executeDateQuery" type="sdx:executeDateQuery" substitutionGroup="sdx:execute"/>
    <xs:element name="executeLinearQuery" type="sdx:executeLinearQuery" substitutionGroup="sdx:execute"/>
    <xs:element name="executeComplexQuery" type="sdx:executeComplexQuery" substitutionGroup="sdx:execute"/>
    <xs:element name="terms" type="sdx:terms" substitutionGroup="sdx:execute"/>
    <xs:element name="includeDocument" type="sdx:includeDocument" substitutionGroup="sdx:execute"/>
    <!-- query -->
    <xs:element name="query" type="sdx:query" abstract="true" substitutionGroup="sdx:action"/>
    <xs:element name="simpleQuery" type="sdx:simpleQuery" substitutionGroup="sdx:query"/>
    <xs:element name="fieldQuery" type="sdx:fieldQuery" substitutionGroup="sdx:query"/>
    <xs:element name="listQuery" type="sdx:listQuery" substitutionGroup="sdx:query"/>
    <xs:element name="dateQuery" type="sdx:dateQuery" substitutionGroup="sdx:query"/>
    <xs:element name="linearQuery" type="sdx:linearQuery" substitutionGroup="sdx:query"/>
    <xs:element name="complexQuery" type="sdx:complexQuery" substitutionGroup="sdx:query"/>
    <xs:element name="expandQuery" type="sdx:expandQuery"/>
    <!-- misc -->
    <xs:element name="uploadDocument" type="sdx:upload"/>
    <xs:element name="uploadDocuments" type="sdx:upload"/>
    <xs:element name="deleteDocument" type="sdx:deleteDocument"/>
    <xs:element name="deleteDocuments" type="sdx:deleteDocuments"/>
    <xs:element name="locations" type="sdx:locations"/>
    <xs:element name="results" type="sdx:results"/>
    <xs:element name="show" type="sdx:show"/>
    <xs:element name="pipeline" type="sdx:pipeline"/>
    <xs:element name="parameter" type="sdx:parameter"/>
    <!--
     |    TYPES
     |-->
    <xs:complexType name="flow" mixed="true">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element ref="sdx:flow"/>
            <xs:element ref="sdx:action"/>
            <xs:group ref="sdx:external"/>
        </xs:choice>
    </xs:complexType>
    <xs:complexType name="page" mixed="true">
        <xs:complexContent>
            <xs:extension base="sdx:flow">
                <xs:attribute ref="xml:lang"/>
                <xs:attributeGroup ref="sdx:show"/>
                <xs:attributeGroup ref="sdx:lang"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <xs:complexType name="action">
        <xs:choice maxOccurs="unbounded" minOccurs="0">
            <xs:element ref="sdx:parameter" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element ref="xsp:logic" minOccurs="0"/>
            <xs:element ref="sdx:fallback" minOccurs="0"/>
            <xs:element ref="sdx:success" minOccurs="0"/>
        </xs:choice>
    </xs:complexType>
    <xs:complexType name="execute">
        <xs:complexContent>
            <xs:extension base="sdx:action">
                <xs:choice maxOccurs="unbounded" minOccurs="0">
                    <xs:element ref="sdx:pipeline" minOccurs="0"/>
                    <xs:element ref="sdx:location" minOccurs="0" maxOccurs="unbounded"/>
                    <xs:element ref="sdx:sort" minOccurs="0" maxOccurs="unbounded"/>
                    <xs:element ref="sdx:expandQuery" minOccurs="0"/>
                </xs:choice>
                <xs:attributeGroup ref="sdx:bqid"/>
                <xs:attributeGroup ref="sdx:locations"/>
                <xs:attributeGroup ref="sdx:results"/>
                <xs:attributeGroup ref="sdx:sort"/>
                <xs:attributeGroup ref="sdx:docs"/>
                <xs:attributeGroup ref="sdx:show"/>
                <xs:attributeGroup ref="sdx:hilite"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <xs:complexType name="query">
        <xs:complexContent>
            <xs:extension base="sdx:action">
                <xs:choice maxOccurs="unbounded" minOccurs="0">
                    <xs:element ref="sdx:expandQuery" minOccurs="0"/>
                    <xs:element ref="sdx:location" minOccurs="0" maxOccurs="unbounded"/>
                    <xs:element ref="sdx:sort" minOccurs="0" maxOccurs="unbounded"/>
                </xs:choice>
                <xs:attributeGroup ref="sdx:bqid"/>
                <xs:attributeGroup ref="sdx:complexop"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <!-- <sdx:locations/> -->
    <xs:complexType name="locations">
        <xs:sequence>
            <xs:element ref="sdx:location" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attributeGroup ref="sdx:locations"/>
    </xs:complexType>
    <!-- <sdx:results/> -->
    <xs:complexType name="results">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element ref="sdx:parameter" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element ref="sdx:sort" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element ref="sdx:fallback" minOccurs="0"/>
            <xs:element ref="sdx:success" minOccurs="0"/>
            <xs:element ref="xsp:logic" minOccurs="0"/>
        </xs:choice>
        <xs:attributeGroup ref="sdx:results"/>
    </xs:complexType>
    <!-- <sdx:show/> -->
    <xs:complexType name="show">
        <xs:attributeGroup ref="sdx:show"/>
        <xs:attributeGroup ref="sdx:docs"/>
        <xs:attributeGroup ref="sdx:hilite"/>
    </xs:complexType>
    <xs:complexType name="expandQuery">
        <xs:attributeGroup ref="sdx:th"/>
    </xs:complexType>
    <!-- COMPLEX -->
    <xs:complexType name="executeComplexQuery">
        <xs:complexContent>
            <xs:extension base="sdx:execute">
                <xs:choice maxOccurs="unbounded" minOccurs="0">
                    <xs:element ref="sdx:simpleQuery"/>
                    <xs:element ref="sdx:fieldQuery"/>
                    <xs:element ref="sdx:listQuery"/>
                    <xs:element ref="sdx:linearQuery"/>
                </xs:choice>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <xs:complexType name="complexQuery">
        <xs:complexContent>
            <xs:extension base="sdx:query">
                <xs:choice maxOccurs="unbounded" minOccurs="0">
                    <xs:element ref="sdx:simpleQuery"/>
                    <xs:element ref="sdx:fieldQuery"/>
                    <xs:element ref="sdx:listQuery"/>
                    <xs:element ref="sdx:linearQuery"/>
                </xs:choice>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <!-- SIMPLE -->
    <xs:complexType name="executeSimpleQuery">
        <xs:complexContent>
            <xs:extension base="sdx:execute">
                <xs:attributeGroup ref="sdx:query"/>
                <xs:attributeGroup ref="sdx:field"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <xs:complexType name="simpleQuery">
        <xs:complexContent>
            <xs:extension base="sdx:query">
                <xs:attributeGroup ref="sdx:query"/>
                <xs:attributeGroup ref="sdx:field"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <!-- FIELD -->
    <xs:complexType name="executeFieldQuery">
        <xs:complexContent>
            <xs:extension base="sdx:execute">
                <xs:attributeGroup ref="sdx:field"/>
                <xs:attributeGroup ref="sdx:value"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <xs:complexType name="fieldQuery">
        <xs:complexContent>
            <xs:extension base="sdx:query">
                <xs:attributeGroup ref="sdx:value"/>
                <xs:attributeGroup ref="sdx:field"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <!-- LIST -->
    <xs:complexType name="executeListQuery">
        <xs:complexContent>
            <xs:extension base="sdx:execute">
                <xs:attributeGroup ref="sdx:field"/>
                <xs:attributeGroup ref="sdx:value"/>
                <xs:attributeGroup ref="sdx:op"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <xs:complexType name="listQuery">
        <xs:complexContent>
            <xs:extension base="sdx:query">
                <xs:attributeGroup ref="sdx:value"/>
                <xs:attributeGroup ref="sdx:field"/>
                <xs:attributeGroup ref="sdx:op"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <!-- DATE -->
    <xs:complexType name="executeDateQuery">
        <xs:complexContent>
            <xs:extension base="sdx:execute">
                <xs:attributeGroup ref="sdx:from"/>
                <xs:attributeGroup ref="sdx:to"/>
                <xs:attributeGroup ref="sdx:field"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <xs:complexType name="dateQuery">
        <xs:complexContent>
            <xs:extension base="sdx:query">
                <xs:attributeGroup ref="sdx:from"/>
                <xs:attributeGroup ref="sdx:to"/>
                <xs:attributeGroup ref="sdx:field"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <!-- LINEAR -->
    <xs:complexType name="executeLinearQuery">
        <xs:complexContent>
            <xs:extension base="sdx:execute">
                <xs:attributeGroup ref="sdx:field"/>
                <xs:attributeGroup ref="sdx:value"/>
                <xs:attributeGroup ref="sdx:op"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <xs:complexType name="linearQuery">
        <xs:complexContent>
            <xs:extension base="sdx:query">
                <xs:attributeGroup ref="sdx:field"/>
                <xs:attributeGroup ref="sdx:value"/>
                <xs:attributeGroup ref="sdx:op"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <xs:complexType name="terms">
        <xs:complexContent>
            <xs:extension base="sdx:execute">
                <xs:attributeGroup ref="sdx:field"/>
                <xs:attributeGroup ref="sdx:value"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <!-- admin -->
    <xs:complexType name="upload">
        <xs:complexContent>
            <xs:extension base="sdx:action">
                <xs:choice maxOccurs="unbounded" minOccurs="0">
                    <xs:element ref="sdx:pipeline" minOccurs="0"/>
                </xs:choice>
                <xs:attributeGroup ref="sdx:app"/>
                <xs:attributeGroup ref="sdx:base"/>
                <xs:attributeGroup ref="sdx:upload"/>
                <xs:attributeGroup ref="sdx:includes"/>
                <xs:attributeGroup ref="sdx:excludes"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <xs:complexType name="deleteDocument">
        <xs:complexContent>
            <xs:extension base="sdx:action">
                <xs:choice maxOccurs="unbounded" minOccurs="0">
                    <xs:element ref="sdx:pipeline" minOccurs="0"/>
                    <xs:element ref="sdx:location" minOccurs="0" maxOccurs="unbounded"/>
                </xs:choice>
                <xs:attributeGroup ref="sdx:app"/>
                <xs:attributeGroup ref="sdx:base"/>
                <xs:attributeGroup ref="sdx:id"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <xs:complexType name="deleteDocuments">
        <xs:complexContent>
            <xs:extension base="sdx:action">
                <xs:choice maxOccurs="unbounded" minOccurs="0">
                    <xs:element ref="sdx:query" minOccurs="0"/>
                    <xs:element ref="sdx:pipeline" minOccurs="0"/>
                </xs:choice>
                <xs:attributeGroup ref="sdx:qid"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <!-- ?
    <xs:element name="attachedDocument">
        <xs:complexType>
            <xs:attributeGroup ref="sdx:upload"/>
        </xs:complexType>
    </xs:element>
-->
    <xs:complexType name="pipeline">
        <xs:sequence>
            <xs:element name="parameter" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:attribute name="name"/>
                    <xs:attributeGroup ref="sdx:value"/>
                </xs:complexType>
            </xs:element>
            <xs:element ref="sdx:transformation" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <xs:element name="transformation">
        <xs:complexType>
            <xs:attributeGroup ref="sdx:id"/>
            <xs:attribute name="type">
                <xs:simpleType>
                    <xs:restriction base="xs:Name">
                        <xs:enumeration value="XSLT"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
            <xs:attributeGroup ref="sdx:src"/>
        </xs:complexType>
    </xs:element>
    <!-- rights -->
    <xs:element name="logout">
        <xs:complexType>
            <xs:attribute name="logout" type="xs:boolean"/>
            <xs:attribute name="logoutParam"/>
            <xs:attribute name="logoutSession"/>
            <xs:attribute name="logoutString"/>
        </xs:complexType>
    </xs:element>
    <xs:complexType name="rights" mixed="true">
        <xs:complexContent>
            <xs:extension base="sdx:flow">
                <xs:attributeGroup ref="sdx:app"/>
                <xs:attributeGroup ref="sdx:group"/>
                <xs:attributeGroup ref="sdx:op"/>
                <xs:attributeGroup ref="sdx:id"/>
                <xs:attributeGroup ref="sdx:pass"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <!-- parameter -->
    <xs:complexType name="parameter">
        <xs:complexContent>
            <xs:extension base="sdx:action">
                <xs:attributeGroup ref="sdx:value"/>
                <xs:attribute name="name">
                    <xs:simpleType>
                        <xs:union memberTypes="xs:string sdx:parameters"/>
                    </xs:simpleType>
                </xs:attribute>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <!-- =========== MISC =========== -->
    <xs:complexType name="includeDocument">
        <xs:complexContent>
            <xs:extension base="sdx:execute">
                <xs:attributeGroup ref="sdx:id"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <xs:element name="location">
        <xs:complexType>
            <xs:attributeGroup ref="sdx:location"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="sort">
        <xs:complexType>
            <xs:attributeGroup ref="sdx:field"/>
            <xs:attributeGroup ref="sdx:order"/>
        </xs:complexType>
    </xs:element>
    <!--
     |    ATTRIBUTES
     |-->
    <!-- Attribute groups for queries -->
    <xs:attributeGroup name="locations">
        <xs:attributeGroup ref="sdx:host"/>
        <xs:attributeGroup ref="sdx:port"/>
        <xs:attributeGroup ref="sdx:app"/>
        <xs:attributeGroup ref="sdx:base"/>
    </xs:attributeGroup>
    <!-- =========== LOCATION =========== -->
    <xs:attributeGroup name="location">
        <xs:attributeGroup ref="sdx:host"/>
        <xs:attributeGroup ref="sdx:port"/>
        <xs:attributeGroup ref="sdx:app"/>
        <xs:attributeGroup ref="sdx:appbypath"/>
        <xs:attributeGroup ref="sdx:base"/>
    </xs:attributeGroup>
    <!-- host -->
    <xs:attributeGroup name="host">
        <xs:attribute name="host"/>
        <xs:attribute name="hostParam"/>
        <xs:attribute name="hostSesssion"/>
        <xs:attribute name="hostString"/>
        <xs:attribute name="hostStrings"/>
    </xs:attributeGroup>
    <!-- port -->
    <xs:attributeGroup name="port">
        <xs:attribute name="port"/>
        <xs:attribute name="portParam"/>
        <xs:attribute name="portSesssion"/>
        <xs:attribute name="portString"/>
        <xs:attribute name="portStrings"/>
    </xs:attributeGroup>
    <!-- app -->
    <xs:attributeGroup name="app">
        <xs:attribute name="app"/>
        <xs:attribute name="appParam"/>
        <xs:attribute name="appSesssion"/>
        <xs:attribute name="appString"/>
        <xs:attribute name="appStrings"/>
    </xs:attributeGroup>
    <!-- appbypath -->
    <xs:attributeGroup name="appbypath">
        <xs:attribute name="appbypath"/>
        <xs:attribute name="appbypathParam"/>
        <xs:attribute name="appbypathSession"/>
        <xs:attribute name="appbypathString"/>
        <xs:attribute name="appbypathStrings"/>
    </xs:attributeGroup>
    <!-- base -->
    <xs:attributeGroup name="base">
        <xs:attribute name="base"/>
        <xs:attribute name="baseParam"/>
        <xs:attribute name="baseSession"/>
        <xs:attribute name="baseString"/>
        <xs:attribute name="baseStrings"/>
    </xs:attributeGroup>
    <!-- =========== SEARCH =========== -->
    <xs:attributeGroup name="search">
        <xs:annotation>
            <xs:documentation xml:lang="en">
                <h1>@search</h1>
                <p>
    Search @params give what to search in a document.
    According to the type of search (simple, field, date ...), 
    different values should be provided. The groups are
</p>
                <ul>
                    <li>query* : simple string query (analysed)</li>
                    <li>value* : simple value usually used in fields query</li>
                    <li>field* : a field isolated at indexation process where to find value*</li>
                    <li>op*    : an operator (and, or, not) about field:value query</li>
                </ul>
                <p>    
    A query is not repeated.
    The trio (value, field, op) could be repeated, they are linked
    by same index in array.
</p>
            </xs:documentation>
        </xs:annotation>
        <xs:attributeGroup ref="sdx:query"/>
        <xs:attributeGroup ref="sdx:value"/>
        <xs:attributeGroup ref="sdx:field"/>
        <xs:attributeGroup ref="sdx:op"/>
        <xs:attributeGroup ref="sdx:from"/>
        <xs:attributeGroup ref="sdx:to"/>
    </xs:attributeGroup>
    <!-- query -->
    <xs:attributeGroup name="query">
        <xs:attribute name="query"/>
        <xs:attribute name="queryParam"/>
        <xs:attribute name="querySession"/>
        <xs:attribute name="queryString"/>
    </xs:attributeGroup>
    <!-- value -->
    <xs:attributeGroup name="value">
        <xs:attribute name="value"/>
        <xs:attribute name="valueParam"/>
        <xs:attribute name="valueSession"/>
        <xs:attribute name="valueString"/>
        <xs:attribute name="valueStrings"/>
    </xs:attributeGroup>
    <!-- field -->
    <xs:attributeGroup name="field">
        <xs:attribute name="field"/>
        <xs:attribute name="fieldParam"/>
        <xs:attribute name="fieldSession"/>
        <xs:attribute name="fieldString"/>
        <xs:attribute name="fieldStrings"/>
    </xs:attributeGroup>
    <!-- op -->
    <xs:attributeGroup name="op">
        <xs:attribute name="op" type="sdx:op"/>
        <xs:attribute name="opParam"/>
        <xs:attribute name="opSession"/>
        <xs:attribute name="opString"/>
        <xs:attribute name="opStrings"/>
    </xs:attributeGroup>
    <!-- complexop -->
    <xs:attributeGroup name="complexop">
        <xs:attribute name="complexop" type="sdx:op"/>
        <xs:attribute name="complexopParam"/>
        <xs:attribute name="complexopSession"/>
        <xs:attribute name="complexopString"/>
    </xs:attributeGroup>
    <!-- from -->
    <xs:attributeGroup name="from">
        <xs:attribute name="from"/>
        <xs:attribute name="fromParam"/>
        <xs:attribute name="fromSession"/>
        <xs:attribute name="fromString"/>
    </xs:attributeGroup>
    <!-- to -->
    <xs:attributeGroup name="to">
        <xs:attribute name="to"/>
        <xs:attribute name="toParam"/>
        <xs:attribute name="toSession"/>
        <xs:attribute name="toString"/>
    </xs:attributeGroup>
    <!-- thesaurus -->
    <xs:attributeGroup name="th">
        <xs:attribute name="th"/>
        <xs:attribute name="thParam"/>
        <xs:attribute name="thSession"/>
        <xs:attribute name="thString"/>
    </xs:attributeGroup>
    <!-- =========== SORT SPECIFICATION =========== -->
    <xs:attributeGroup name="sort">
        <xs:annotation>
            <xs:documentation xml:lang="en">
                <h1>Sort specification</h1>
                <p>
        A query is by default sorted by scoring.
        Order could be given against a field.
                </p>
                <ul>
                    <li>sf*    : repeatable field name</li>
                    <li>so*    : sort order for each field</li>
                </ul>
            </xs:documentation>
        </xs:annotation>
        <xs:attributeGroup ref="sdx:sf"/>
        <xs:attributeGroup ref="sdx:so"/>
    </xs:attributeGroup>
    <!-- sort field -->
    <xs:attributeGroup name="sf">
        <xs:attribute name="sf"/>
        <xs:attribute name="sfParam"/>
        <xs:attribute name="sfSession"/>
        <xs:attribute name="sfString"/>
    </xs:attributeGroup>
    <!-- sort order -->
    <xs:attributeGroup name="so">
        <xs:attribute name="so" type="sdx:order"/>
        <xs:attribute name="soParam"/>
        <xs:attribute name="soSession"/>
        <xs:attribute name="soString"/>
    </xs:attributeGroup>
    <!-- order attribute in a sort element -->
    <xs:attributeGroup name="order">
        <xs:attribute name="order" type="sdx:order"/>
        <xs:attribute name="orderParam"/>
        <xs:attribute name="orderSession"/>
        <xs:attribute name="orderString"/>
    </xs:attributeGroup>
    <!--  =========== RESULTS =========== -->
    <xs:attributeGroup name="results">
        <xs:annotation>
            <xs:documentation xml:lang="en">
            Results from a query (<sdx:search/>, <sdx:query/> ...) could be long.
            By default, SDX answers with a first page of 20 results (hpp).
            This value is modified by attributes @hpp*.
            To retrieve next/previous page, each query is cached for a client
            session. By default, an id is generated, given in the root element
            of <sdx:results/> or <sdx:terms/>.
                <sdx:results id="q1" start="20" end="39" nb="80" nbPages="4" currentPage="2">
                ...
                </sdx:results>
                <sdx:terms id="q2" start="4" end="4" nb="5" nbPages="5" currentPage="4">
    ...<!-- hpp=1 -->
                </sdx:terms>
            </xs:documentation>
        </xs:annotation>
        <xs:attributeGroup ref="sdx:qid"/>
        <xs:attributeGroup ref="sdx:page"/>
        <xs:attributeGroup ref="sdx:hpp"/>
        <xs:attributeGroup ref="sdx:no"/>
    </xs:attributeGroup>
    <!-- query id -->
    <xs:attributeGroup name="qid">
        <xs:annotation>
            <xs:documentation xml:lang="en">
            Id of a cached query (<sdx:search/>, <sdx:terms/> ...),
            used for next/prev page in results.
            Id of a cached query (sdx:search or sdx:terms),
            used for next/prev page in results.
            If present, the results are cached with the id given.
            (query executed one time per session)
            </xs:documentation>
        </xs:annotation>
        <xs:attribute name="qid"/>
        <xs:attribute name="qidParam"/>
        <xs:attribute name="qidSession"/>
        <xs:attribute name="qidString"/>
        <!-- <xs:attribute name="qidStrings"/> ??? useful -->
    </xs:attributeGroup>
    <!-- base query -->
    <xs:attributeGroup name="bqid">
        <xs:annotation>
            <xs:documentation xml:lang="en">
            Id of a results object, already cached
            used as a base query (to search in results)
            </xs:documentation>
        </xs:annotation>
        <xs:attribute name="bqid"/>
        <xs:attribute name="bqidParam"/>
        <xs:attribute name="bqidSession"/>
        <xs:attribute name="bqidString"/>
        <!-- <xs:attribute name="qidStrings"/> ??? useful -->
    </xs:attributeGroup>
    <!-- page -->
    <xs:attributeGroup name="page">
        <xs:attribute name="page"/>
        <xs:attribute name="pageParam"/>
        <xs:attribute name="pageSession"/>
        <xs:attribute name="pageInt"/>
    </xs:attributeGroup>
    <!-- <xs:attribute name="pageInts"/> !!! useful -->
    <!-- no -->
    <xs:attributeGroup name="no">
        <xs:attribute name="no"/>
        <xs:attribute name="noParam"/>
        <xs:attribute name="noSession"/>
        <xs:attribute name="noInt"/>
        <!-- <xs:attribute name="noInts"/> !!! useful -->
    </xs:attributeGroup>
    <!-- hpp -->
    <xs:attributeGroup name="hpp">
        <xs:attribute name="hpp"/>
        <xs:attribute name="hppParam"/>
        <xs:attribute name="hppSession"/>
        <xs:attribute name="hppInt"/>
    </xs:attributeGroup>
    <!-- ========= SHOW ======== -->
    <!-- show -->
    <xs:attributeGroup name="show">
        <xs:attribute name="show">
            <xs:simpleType>
                <xs:list itemType="sdx:shows"/>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="showParam"/>
        <xs:attribute name="showSession"/>
        <xs:attribute name="showString"/>
    </xs:attributeGroup>
    <!-- docs -->
    <xs:attributeGroup name="docs">
        <xs:attribute name="docs" type="xs:boolean"/>
        <xs:attribute name="docsParam"/>
        <xs:attribute name="docsSession"/>
        <xs:attribute name="docsString"/>
    </xs:attributeGroup>
    <!-- hilite -->
    <xs:attributeGroup name="hilite">
        <xs:attribute name="hilite" type="xs:boolean"/>
        <xs:attribute name="hiliteParam"/>
        <xs:attribute name="hiliteSession"/>
        <xs:attribute name="hiliteString"/>
    </xs:attributeGroup>
    <!-- ========== UPLOAD ============ -->
    <xs:attributeGroup name="upload">
        <xs:annotation>
            <xs:documentation xml:lang="en">
                <h1>@sdx:upload</h1>
            </xs:documentation>
        </xs:annotation>
        <xs:attributeGroup ref="sdx:url"/>
        <xs:attributeGroup ref="sdx:type"/>
        <xs:attributeGroup ref="sdx:repo"/>
        <xs:attributeGroup ref="sdx:file"/>
        <xs:attributeGroup ref="sdx:dir"/>
        <xs:attributeGroup ref="sdx:xml"/>
    </xs:attributeGroup>
    <xs:attributeGroup name="includes">
        <xs:annotation>
            <xs:documentation xml:lang="en">
    pattern with no more than one star, like *.xml or tmp*
    to filter file names (here includes)
            </xs:documentation>
        </xs:annotation>
        <xs:attribute name="includes"/>
        <xs:attribute name="includesParam"/>
        <xs:attribute name="includesSession"/>
        <xs:attribute name="includesString"/>
    </xs:attributeGroup>
    <xs:attributeGroup name="excludes">
        <xs:annotation>
            <xs:documentation xml:lang="en">
    pattern with no more than one star, like *.xml or tmp*
    to filter file names (here excludes)
            </xs:documentation>
        </xs:annotation>
        <xs:attribute name="excludes"/>
        <xs:attribute name="excludesParam"/>
        <xs:attribute name="excludesSession"/>
        <xs:attribute name="excludesString"/>
    </xs:attributeGroup>
    <!-- == url == -->
    <xs:attributeGroup name="url">
        <xs:annotation>
            <xs:documentation xml:lang="en">
            TODOC
            </xs:documentation>
        </xs:annotation>
        <xs:attribute name="url"/>
        <xs:attribute name="urlParam"/>
        <xs:attribute name="urlSession"/>
        <xs:attribute name="urlString"/>
    </xs:attributeGroup>
    <!-- == type == -->
    <xs:attributeGroup name="type">
        <xs:annotation>
            <xs:documentation xml:lang="en">
            TODOC
            </xs:documentation>
        </xs:annotation>
        <xs:attribute name="type"/>
        <xs:attribute name="typeParam"/>
        <xs:attribute name="typeSession"/>
        <xs:attribute name="typeString"/>
    </xs:attributeGroup>
    <!-- == repo == -->
    <xs:attributeGroup name="repo">
        <xs:annotation>
            <xs:documentation xml:lang="en">
            TODOC
            </xs:documentation>
        </xs:annotation>
        <xs:attribute name="repo"/>
        <xs:attribute name="repoParam"/>
        <xs:attribute name="repoSession"/>
        <xs:attribute name="repoString"/>
    </xs:attributeGroup>
    <!-- == file == -->
    <xs:attributeGroup name="file">
        <xs:annotation>
            <xs:documentation xml:lang="en">
            TODOC
            </xs:documentation>
        </xs:annotation>
        <xs:attribute name="file"/>
        <xs:attribute name="fileParam"/>
        <xs:attribute name="fileSession"/>
        <xs:attribute name="fileString"/>
        <xs:attribute name="fileFile"/>
    </xs:attributeGroup>
    <!-- == dir == -->
    <xs:attributeGroup name="dir">
        <xs:annotation>
            <xs:documentation xml:lang="en">
            TODOC
            </xs:documentation>
        </xs:annotation>
        <xs:attribute name="dir"/>
        <xs:attribute name="dirParam"/>
        <xs:attribute name="dirSession"/>
        <xs:attribute name="dirString"/>
    </xs:attributeGroup>
    <!-- == xml == -->
    <xs:attributeGroup name="xml">
        <xs:annotation>
            <xs:documentation xml:lang="en">
    get an xml document in a string to serialize
            </xs:documentation>
        </xs:annotation>
        <xs:attribute name="xml">
            <xs:annotation>
                <xs:documentation xml:lang="en">
    could be used as a default value if errors in param
            </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="xmlParam"/>
        <xs:attribute name="xmlString"/>
        <xs:attribute name="xmlSession"/>
    </xs:attributeGroup>
    <!-- =========== MISC =========== -->
    <!-- group -->
    <xs:attributeGroup name="group">
        <xs:attribute name="group"/>
        <xs:attribute name="groupParam"/>
        <xs:attribute name="groupSession"/>
        <xs:attribute name="groupString"/>
    </xs:attributeGroup>
    <!-- id -->
    <xs:attributeGroup name="id">
        <xs:attribute name="id"/>
        <xs:attribute name="idParam"/>
        <xs:attribute name="idSession"/>
        <xs:attribute name="idString"/>
    </xs:attributeGroup>
    <!-- pass -->
    <xs:attributeGroup name="pass">
        <xs:attribute name="pass"/>
        <xs:attribute name="passParam"/>
        <xs:attribute name="passSession"/>
        <xs:attribute name="passString"/>
    </xs:attributeGroup>
    <!-- lang -->
    <xs:attributeGroup name="lang">
        <xs:attribute name="lang"/>
        <xs:attribute name="langParam"/>
        <xs:attribute name="langSession"/>
        <xs:attribute name="langString"/>
    </xs:attributeGroup>
    <!-- name -->
    <xs:attributeGroup name="name">
        <xs:attribute name="name"/>
        <xs:attribute name="nameParam"/>
        <xs:attribute name="nameSession"/>
        <xs:attribute name="nameString"/>
    </xs:attributeGroup>
    <!-- src -->
    <xs:attributeGroup name="src">
        <xs:attribute name="src"/>
        <xs:attribute name="srcParam"/>
        <xs:attribute name="srcSession"/>
        <xs:attribute name="srcString"/>
    </xs:attributeGroup>
    <!--
     |    Lists
     |-->
    <xs:simpleType name="parameters">
        <xs:restriction base="xs:Name">
            <!-- location -->
            <xs:enumeration value="host"/>
            <xs:enumeration value="port"/>
            <xs:enumeration value="app"/>
            <xs:enumeration value="base"/>
            <!-- query -->
            <xs:enumeration value="query"/>
            <xs:enumeration value="field"/>
            <xs:enumeration value="value"/>
            <xs:enumeration value="op"/>
            <xs:enumeration value="complexop"/>
            <xs:enumeration value="id"/>
            <xs:enumeration value="from"/>
            <xs:enumeration value="to"/>
            <xs:enumeration value="th"/>
            <!-- cache -->
            <xs:enumeration value="no"/>
            <xs:enumeration value="page"/>
            <xs:enumeration value="qid"/>
            <xs:enumeration value="hpp"/>
            <!-- upload -->
            <xs:enumeration value="url"/>
            <xs:enumeration value="file"/>
            <xs:enumeration value="dir"/>
            <xs:enumeration value="zip"/>
        </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="shows">
        <xs:restriction base="xs:Name">
            <!-- sdx:document -->
            <xs:enumeration value="user"/>
            <xs:enumeration value="application"/>
            <xs:enumeration value="get"/>
            <xs:enumeration value="post"/>
            <xs:enumeration value="session"/>
            <xs:enumeration value="headers"/>
            <xs:enumeration value="objects"/>
            <!-- sdx:results -->
            <xs:enumeration value="documents"/>
            <xs:enumeration value="sdx:results"/>
            <xs:enumeration value="fields"/>
            <!-- sdx:uploadDocuments -->
            <xs:enumeration value="summary"/>
            <xs:enumeration value="failures"/>
            <xs:enumeration value="additions"/>
        </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="order">
        <xs:restriction base="xs:Name">
            <xs:enumeration value="ascending"/>
            <xs:enumeration value="descending"/>
        </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="op">
        <xs:restriction base="xs:Name">
            <xs:enumeration value="and"/>
            <xs:enumeration value="or"/>
        </xs:restriction>
    </xs:simpleType>
</xs:schema>
