<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.cdisc.org/ns/odm/v1.3"
  xmlns="http://www.cdisc.org/ns/odm/v1.3"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:def="http://www.cdisc.org/ns/def/v2.0"
  xmlns:odm="http://www.cdisc.org/ns/odm/v1.3"
  elementFormDefault="qualified"
  attributeFormDefault="unqualified">


  <!--
      Define-XML 2.0.0 define-extension schema draft
      as developed by the CDISC XML Technologies Team
  -->

  <xs:import namespace="http://www.cdisc.org/ns/def/v2.0"
    schemaLocation="define-ns.xsd"/>
  <xs:redefine schemaLocation="../cdisc-odm-1.3.2/ODM1-3-2.xsd">


    <!--
        MetaDataVersion
    -->
    <xs:attributeGroup name="MetaDataVersionAttributeExtension">
      <xs:attributeGroup ref="MetaDataVersionAttributeExtension"/>
      <xs:attribute ref="def:DefineVersion" use="required" fixed="2.0.0"/>
      <xs:attribute ref="def:StandardName" use="required"/>
      <xs:attribute ref="def:StandardVersion" use="required"/>
    </xs:attributeGroup>

    <xs:group name="MetaDataVersionPreIncludeElementExtension">
      <xs:sequence>
        <xs:group ref="MetaDataVersionPreIncludeElementExtension"/>
        <xs:element ref="def:AnnotatedCRF" minOccurs="0" maxOccurs="1"/>
        <xs:element ref="def:SupplementalDoc" minOccurs="0" maxOccurs="1"/>
        <!-- moved to end of MetaDataVersion -->
        <!-- <xs:element ref="def:leaf" minOccurs="0" maxOccurs="unbounded"/> -->
        <!-- deprecated: replaced by odm:MethodDef -->
        <!-- <xs:element ref="def:ComputationMethod" minOccurs="0" maxOccurs="unbounded"/> -->
        <xs:element ref="def:ValueListDef" minOccurs="0" maxOccurs="unbounded"/>
        <xs:element ref="def:WhereClauseDef" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:group>

    <xs:group name="MetaDataVersionElementExtension">
      <xs:sequence>
        <xs:group ref="MetaDataVersionElementExtension"/>
        <xs:element ref="def:CommentDef" minOccurs="0" maxOccurs="unbounded"/>
        <xs:element ref="def:leaf" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:group>


    <!--
        ItemGroupDef
    -->
    <xs:attributeGroup name="ItemGroupDefAttributeExtension">
      <xs:attributeGroup ref="ItemGroupDefAttributeExtension"/>
      <!-- deprecated: replaced by odm:Description -->
      <!-- <xs:attribute ref="def:Label" use="required"/> -->
      <xs:attribute ref="def:Structure" use="required"/>
      <!-- deprecated: replaced by odm:ItemRef/@KeySequence -->
      <!-- <xs:attribute ref="def:DomainKeys" use="optional"/> -->
      <xs:attribute ref="def:Class" use="optional"/>
      <xs:attribute ref="def:ArchiveLocationID" use="optional"/>
      <xs:attribute ref="def:CommentOID" use="optional"/>
    </xs:attributeGroup>

    <xs:group name="ItemGroupDefElementExtension">
      <xs:sequence>
        <xs:group ref="ItemGroupDefElementExtension"/>
        <xs:element ref="def:leaf" minOccurs="0" maxOccurs="1"/>
      </xs:sequence>
    </xs:group>


    <!--
        ItemRef
    -->
    <xs:group name="ItemRefElementExtension">
      <xs:sequence>
        <xs:group ref="ItemRefElementExtension"/>
        <xs:element ref="def:WhereClauseRef" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:group>


    <!--
        ItemDef
    -->
    <xs:attributeGroup name="ItemDefAttributeExtension">
      <xs:attributeGroup ref="ItemDefAttributeExtension"/>
      <!-- deprecated: replaced by odm:Description -->
      <!-- <xs:attribute ref="def:Label" use="required"/> -->
      <xs:attribute ref="def:DisplayFormat" use="optional"/>
      <!-- deprecated: replaced by odm:MethodDef -->
      <!-- <xs:attribute ref="def:ComputationMethodOID"/> -->
      <xs:attribute ref="def:CommentOID" use="optional"/>
    </xs:attributeGroup>

    <xs:group name="ItemDefElementExtension">
      <xs:sequence>
        <xs:group ref="ItemDefElementExtension"/>
        <xs:element ref="def:Origin" minOccurs="0" maxOccurs="unbounded"/>
        <!-- spec says required but  optional for bkwd compatibility -->
        <xs:element ref="def:ValueListRef" minOccurs="0" maxOccurs="1"/>
      </xs:sequence>
    </xs:group>


    <!--
        RangeCheck
    -->
    <xs:attributeGroup name="RangeCheckAttributeExtension">
      <xs:attributeGroup ref="RangeCheckAttributeExtension"/>
      <xs:attribute ref="def:ItemOID" use="required"/>
    </xs:attributeGroup>


    <!--
          CodeListItem and EnumeratedItem
      -->
    <xs:attributeGroup name="CodeListItemAttributeExtension">
      <xs:attributeGroup ref="CodeListItemAttributeExtension"/>
      <!-- deprecated: replaced by odm:Rank -->
      <!-- <xs:attribute ref="def:Rank"/> -->
      <xs:attribute ref="def:ExtendedValue" use="optional"/>
    </xs:attributeGroup>

    <xs:attributeGroup name="EnumeratedItemAttributeExtension">
      <xs:attributeGroup ref="EnumeratedItemAttributeExtension"/>
      <xs:attribute ref="def:ExtendedValue" use="optional"/>
    </xs:attributeGroup>


    <!--
          Methoddef
      -->

    <xs:group name="MethodDefElementExtension">
      <xs:sequence>
        <xs:group ref="MethodDefElementExtension"/>
        <xs:element ref="def:DocumentRef" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:group>


  </xs:redefine>

</xs:schema>
