<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE  xs:schema >
<xs:schema attributeFormDefault="unqualified"
           elementFormDefault="unqualified"
           version="1.0"
           xmlns:gdml_simple_extension="http://www.example.org/"
           xmlns:gdml="http://cern.ch/2001/Schemas/GDML"
           xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:redefine schemaLocation="gdml.xsd">

    <xs:annotation>
      <xs:documentation>
        Extend the volume element using the redefine tag.
      </xs:documentation>
    </xs:annotation>

    <xs:complexType name="VolumeType">
      <xs:annotation>
        <xs:documentation>
          Extend the VolumeType defined by GDML.
        </xs:documentation>
      </xs:annotation>      
      <xs:complexContent>
        <xs:extension base="VolumeType">
          <xs:sequence>
            <xs:element minOccurs="0" maxOccurs="1" name="colorref" type="ReferenceType"/>
          </xs:sequence>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:redefine>

  <xs:complexType name="extensionType">
    <xs:annotation>
      <xs:documentation>
        Contains color elements.
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="color" minOccurs="0" maxOccurs="unbounded" type="ColorType" />
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="ColorType">
    <xs:annotation>
      <xs:documentation>
        A complex type defining RGBA values for geometric data display.  
        These values will be loaded into a G4VisAttributes object assigned
        to the G4LogicalVolume.
      </xs:documentation>
    </xs:annotation>
    <xs:attribute name="name" type="xs:ID" use="required" />
    <xs:attribute name="R" type="xs:double" default="1.0"/>
    <xs:attribute name="G" type="xs:double" default="1.0"/>
    <xs:attribute name="B" type="xs:double" default="1.0"/>
    <xs:attribute name="A" type="xs:double" default="1.0" />
  </xs:complexType>

  <xs:element name="extension" type="extensionType"/>
  <xs:element name="gdml_simple_extension">
        <!--<xs:element ref="define"/>-->
    <xs:annotation>
      <xs:documentation>
        Top-level element including the gdml element
        plus a container extension element for e.g.
        fields, SDs, regions and components.
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="extension" minOccurs="0" maxOccurs="1"/>
        <xs:element ref="define" minOccurs="1"/>
        <xs:element ref="materials" minOccurs="0"/>
        <xs:element ref="solids" minOccurs="1"/>
        <xs:element ref="structure" minOccurs="1"/>
        <xs:element maxOccurs="unbounded" name="setup">
          <xs:annotation>
            <xs:documentation>Geometry setup representing the particular geometry hierarchy by refferring to
              a given volume which becomes the top level volume</xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="world" type="ReferenceType">
                <xs:annotation>
                  <xs:documentation>A reference to the previously defined volume
                    in the structure block chosen by this setup
                    World volumme can't be an assembly volume</xs:documentation>
                </xs:annotation>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="name" type="xs:ID" use="required"/>
            <xs:attribute name="version" type="xs:string" use="required"/>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
      <xs:attribute fixed="2.10.0" name="version" type="xs:string">
        <xs:annotation>
          <xs:documentation>The GDML Schema version consists of 3 digits X.Y.Z
            where these mean:
            X - major number, increased when major new
            features or backward incompatible bug fixes
            are added and means the GDML Processor is
            allowed to refuse processing of such a
            document if this is using the more recent
            version of the GDML Schema then GDML Processor
            understands 
            Y - minor number, increased when incremental and
            backward compatible changes or improvements
            are made into the GDML Schema. GDML Processor
            should be able to process such a document
            using higher minor version number then that of
            the GDML Processor
            Z - bugfix revision number, increased when fully
            backward compatible changes which resolve a
            problem in GDML Schema are applied</xs:documentation>
        </xs:annotation>
      </xs:attribute>
    </xs:complexType>
  </xs:element>
</xs:schema>
