<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:gdml="http://cern.ch/2001/Schemas/GDML"
           xmlns:xs="http://www.w3.org/2001/XMLSchema"
           elementFormDefault="unqualified"
           attributeFormDefault="unqualified"
           version="0.1">
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
 <xs:include schemaLocation="gdml_simple_core.xsd"/>
 <xs:include schemaLocation="gdml_simple_define.xsd"/>
  <!-- Removed abstract="true" in AtomType -->
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
 <xs:complexType name="AtomType">
  <xs:annotation>
   <xs:documentation>
        Atomic mass, quantity type A, default unit g/mole
   </xs:documentation>
  </xs:annotation>
  <xs:complexContent>
   <xs:restriction base="QuantityType">
    <xs:attribute name="unit" default="g/mole"/>
    <xs:attribute name="type" fixed="A"/>
   </xs:restriction>
  </xs:complexContent>
 </xs:complexType>
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
 <xs:complexType name="DensityType">
  <xs:annotation>
   <xs:documentation>Density</xs:documentation>
  </xs:annotation>
  <xs:complexContent>
   <xs:restriction base="QuantityType">
    <xs:attribute name="unit" default="g/cm3"/>
    <xs:attribute name="type" fixed="density"/>
   </xs:restriction>
  </xs:complexContent>
 </xs:complexType>
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
 <xs:group name="MaterialPropertiesGroup">
  <xs:annotation>
   <xs:documentation>General material properties</xs:documentation>
  </xs:annotation>
  <xs:sequence>
   <xs:choice minOccurs="0">
    <xs:element name="RL">
     <xs:annotation>
      <xs:documentation>
              Radiation length
      </xs:documentation>
     </xs:annotation>
     <xs:complexType>
      <xs:complexContent>
       <xs:restriction base="QuantityType">
        <xs:attribute name="unit" default="cm"/>
        <xs:attribute name="type" fixed="X0"/>
       </xs:restriction>
      </xs:complexContent>
     </xs:complexType>
    </xs:element>
    <xs:element name="RLref" type="ReferenceType">
     <xs:annotation>
      <xs:documentation>
              A reference to a previsouly defined named radiation length quantity value
      </xs:documentation>
     </xs:annotation>
    </xs:element>
   </xs:choice>
   <xs:choice minOccurs="0">
    <xs:element name="AL">
     <xs:annotation>
      <xs:documentation>Absorption length</xs:documentation>
     </xs:annotation>
     <xs:complexType>
      <xs:complexContent>
       <xs:restriction base="QuantityType">
        <xs:attribute name="unit" default="cm"/>
        <xs:attribute name="type" fixed="lambda"/>
       </xs:restriction>
      </xs:complexContent>
     </xs:complexType>
    </xs:element>
    <xs:element name="ALref" type="ReferenceType">
     <xs:annotation>
      <xs:documentation>
              A reference to a previsouly defined named absorption length quantity value
      </xs:documentation>
     </xs:annotation>
    </xs:element>
   </xs:choice>
   <xs:choice minOccurs="0">
    <xs:element name="T">
     <xs:annotation>
      <xs:documentation>Temperature</xs:documentation>
     </xs:annotation>
     <xs:complexType>
      <xs:complexContent>
       <xs:restriction base="QuantityType">
        <xs:attribute name="unit" default="K"/>
        <xs:attribute name="type" fixed="temperature"/>
       </xs:restriction>
      </xs:complexContent>
     </xs:complexType>
    </xs:element>
    <xs:element name="Tref" type="ReferenceType">
     <xs:annotation>
      <xs:documentation>
              A reference to previously defined named temperature quantity value
      </xs:documentation>
     </xs:annotation>
    </xs:element>
   </xs:choice>
   <xs:choice minOccurs="0">
    <xs:element name="P">
     <xs:annotation>
      <xs:documentation>Pressure</xs:documentation>
     </xs:annotation>
     <xs:complexType>
      <xs:complexContent>
       <xs:restriction base="QuantityType">
        <xs:attribute name="unit" default="pascal"/>
        <xs:attribute name="type" fixed="pressure"/>
       </xs:restriction>
      </xs:complexContent>
     </xs:complexType>
    </xs:element>
    <xs:element name="Pref" type="ReferenceType">
     <xs:annotation>
      <xs:documentation>
              A reference to previously defined named pressure quantity value
      </xs:documentation>
     </xs:annotation>
    </xs:element>
   </xs:choice>
  </xs:sequence>
 </xs:group>
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
 <xs:attributeGroup name="MaterialAttributeGroup">
  <xs:annotation>
   <xs:documentation>
        General material attributes
   </xs:documentation>
  </xs:annotation>
  <xs:attribute name="name" type="xs:ID" use="required">
   <xs:annotation>
    <xs:documentation>Material name</xs:documentation>
   </xs:annotation>
  </xs:attribute>
  <xs:attribute name="formula" type="xs:string" use="optional">
   <xs:annotation>
    <xs:documentation>Material chemical formula</xs:documentation>
   </xs:annotation>
  </xs:attribute>
  <xs:attribute name="state" default="unknown">
   <xs:annotation>
    <xs:documentation>
          Material physical state
    </xs:documentation>
   </xs:annotation>
   <xs:simpleType>
    <xs:restriction base="xs:NMTOKEN">
     <xs:enumeration value="gas"/>
     <xs:enumeration value="liquid"/>
     <xs:enumeration value="solid"/>
     <xs:enumeration value="unknown"/>
    </xs:restriction>
   </xs:simpleType>
  </xs:attribute>
 </xs:attributeGroup>
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
 <xs:complexType name="MaterialType">
  <xs:annotation>
   <xs:documentation>
        Base type for materials
   </xs:documentation>
  </xs:annotation>
  <xs:group ref="MaterialPropertiesGroup"/>
  <xs:attributeGroup ref="MaterialAttributeGroup"/>
 </xs:complexType>
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<!--
 <xs:complexType name="ComplexMaterialType">
  <xs:annotation>
   <xs:documentation>
        Base type for complex materials
   </xs:documentation>
  </xs:annotation>
  <xs:complexContent>
   <xs:extension base="MaterialType">
-->
    <!-- <xs:group ref="MaterialPropertiesGroup"/> -->
    <!--
          Removed from referenced attribute group
          <xs:attribute name="N" use="prohibited"/>
        -->
<!--        
      <xs:attribute name="Z" type="xs:double" use="optional">
       <xs:annotation>
        <xs:documentation>Atomic number</xs:documentation>
       </xs:annotation>
      </xs:attribute>
   </xs:extension>
  </xs:complexContent>
 </xs:complexType>
 -->
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
 <xs:element name="materials">
  <xs:annotation>
   <xs:documentation>Materials description</xs:documentation>
  </xs:annotation>
  <xs:complexType>
   <xs:sequence>
    <xs:element name="define" type="defineType" minOccurs="0">
     <xs:annotation>
      <xs:documentation>
              Material related definitons of constants and quantities
              In this version of schema these become visible in global scope
      </xs:documentation>
     </xs:annotation>
    </xs:element>
    <xs:element name="isotope" type="MaterialIsotopeType"
                    minOccurs="0" maxOccurs="unbounded">
     <xs:annotation>
      <xs:documentation>An isotope</xs:documentation>
     </xs:annotation>
    </xs:element>
    <xs:element name="element" type="MaterialElementType"
                    minOccurs="0" maxOccurs="unbounded">
     <xs:annotation>
      <xs:documentation>
              A simple element or an element compoased of isotopes
      </xs:documentation>
     </xs:annotation>
    </xs:element>
    <xs:element name="material" type="MaterialMixtureType"
                    minOccurs="0" maxOccurs="unbounded">
     <xs:annotation>
      <xs:documentation>
              A composite or a mixture complex material
      </xs:documentation>
     </xs:annotation>
    </xs:element>
   </xs:sequence>
  </xs:complexType>
 </xs:element>
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
 <xs:complexType name="MaterialIsotopeType">
  <xs:annotation>
   <xs:documentation>Exported isotope type</xs:documentation>
  </xs:annotation>
  <xs:complexContent>
   <xs:extension base="MaterialType">
    <xs:sequence>
     <xs:choice minOccurs="0">
      <xs:element name="D" type="DensityType">
       <xs:annotation>
        <xs:documentation>
            Density quantity value
        </xs:documentation>
       </xs:annotation>
      </xs:element>
      <xs:element name="Dref" type="ReferenceType">
       <xs:annotation>
        <xs:documentation>
            A reference to a previsouly defined named density quantity value
        </xs:documentation>
       </xs:annotation>
      </xs:element>
     </xs:choice>
     <xs:element name="atom" type="AtomType"/>
    </xs:sequence>
    <xs:attribute name="N" type="xs:positiveInteger" use="required">
     <xs:annotation>
      <xs:documentation>Number of nucleons</xs:documentation>
     </xs:annotation>
    </xs:attribute>
    <xs:attribute name="Z" type="xs:double" use="required">
     <xs:annotation>
      <xs:documentation>Atomic number</xs:documentation>
     </xs:annotation>
    </xs:attribute>
   </xs:extension>
  </xs:complexContent>
 </xs:complexType>
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
 <xs:complexType name="MaterialElementType">
  <xs:annotation>
   <xs:documentation>Exported material element type</xs:documentation>
  </xs:annotation>
  <xs:complexContent>
   <xs:extension base="MaterialType">
    <xs:sequence>
     <xs:choice minOccurs="0">
      <xs:element name="D" type="DensityType">
       <xs:annotation>
        <xs:documentation>
            Density quantity value
        </xs:documentation>
       </xs:annotation>
      </xs:element>
      <xs:element name="Dref" type="ReferenceType">
       <xs:annotation>
        <xs:documentation>
            A reference to a previsouly defined named density quantity value
        </xs:documentation>
       </xs:annotation>
      </xs:element>
     </xs:choice>
     <xs:choice>
      <xs:annotation>
       <xs:documentation>
                An element can be defined either as a simple element or by a set
                of isotopes fractions
       </xs:documentation>
      </xs:annotation>
      <xs:element name="atom" type="AtomType"/>
      <xs:element name="fraction" maxOccurs="unbounded">
       <xs:annotation>
        <xs:documentation>
                  An isotope fraction of an element where n is the actual amount
                  of the isotope in the element
        </xs:documentation>
       </xs:annotation>
       <xs:complexType>
        <xs:complexContent>
         <xs:extension base="ReferenceType">
          <xs:attribute name="n" type="xs:double" use="required"/>
         </xs:extension>
        </xs:complexContent>
       </xs:complexType>
      </xs:element>
     </xs:choice>
    </xs:sequence>
    <xs:attribute name="N" type="xs:positiveInteger" use="optional">
     <xs:annotation>
      <xs:documentation>Number of nucleons</xs:documentation>
     </xs:annotation>
    </xs:attribute>
    <xs:attribute name="Z" type="xs:double" use="optional">
     <xs:annotation>
      <xs:documentation>Atomic number</xs:documentation>
     </xs:annotation>
    </xs:attribute>
   </xs:extension>
  </xs:complexContent>
 </xs:complexType>
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
 <xs:complexType name="MaterialMixtureType">
  <xs:annotation>
   <xs:documentation>
        Exported material composite or mixture type
   </xs:documentation>
  </xs:annotation>
  <xs:complexContent>
   <!-- <xs:extension base="ComplexMaterialType"> -->
   <xs:extension base="MaterialType">
    <xs:sequence>
      <xs:choice>
      <xs:element name="D" type="DensityType">
       <xs:annotation>
        <xs:documentation>
            Density quantity value
        </xs:documentation>
       </xs:annotation>
      </xs:element>
      <xs:element name="Dref" type="ReferenceType">
       <xs:annotation>
        <xs:documentation>
            A reference to a previsouly defined named density quantity value
        </xs:documentation>
       </xs:annotation>
      </xs:element>
      </xs:choice>
      <xs:choice>
       <xs:annotation>
        <xs:documentation>
                A complex material can be defined as a simple mixture when
                its material properties are known or as a composite material
                or a mixture. A composite material is defined by a set of elements
                by specifying the number of atoms.
                The second way is by a set of material fractions where the fractions
                can be either simple elements or other complex materials.
                The restriction is that one can't mix composition by atoms and fractions
                at the same time.
        </xs:documentation>
       </xs:annotation>
       <xs:element name="atom" type="AtomType"/>
       <xs:element name="composite" maxOccurs="unbounded">
        <xs:annotation>
         <xs:documentation>
                  Elements of this composite material specified as a set of local references
                  to already defined simple elements where value of n in each means the number of atoms
         </xs:documentation>
        </xs:annotation>
        <xs:complexType>
         <xs:complexContent>
          <xs:extension base="ReferenceType">
           <xs:attribute name="n" type="xs:positiveInteger" use="required"/>
          </xs:extension>
         </xs:complexContent>
        </xs:complexType>
       </xs:element>
       <xs:element name="fraction" maxOccurs="unbounded">
        <xs:annotation>
         <xs:documentation>
                  Fractions of this mixture specified as a set of local references to already defined
                  elements or other mixtures where value of n in each means the fraction of the whole
                  material in the range 0.0 &lt; n &lt; 1.0
         </xs:documentation>
        </xs:annotation>
        <xs:complexType>
         <xs:complexContent>
          <xs:extension base="ReferenceType">
           <xs:attribute name="n" type="xs:double" use="required"/>
          </xs:extension>
         </xs:complexContent>
        </xs:complexType>
       </xs:element>
      </xs:choice>
    </xs:sequence>
    <xs:attribute name="Z" type="xs:double" use="optional">
     <xs:annotation>
      <xs:documentation>Atomic number</xs:documentation>
     </xs:annotation>
    </xs:attribute>
   </xs:extension>
  </xs:complexContent>
 </xs:complexType>
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
</xs:schema>