<?xml version="1.0" encoding="utf-8"?>
<!--  NOTE
System: DFO-ELOG

Form:       43792 - ELOG - Inactivity Report
Formulaire: 43792 - JBE - Rapport d'inactivite
 
Form_ver_id: 233

Goal: Validation of XML datafiles destinated to the Electronic logbooks system of DFO (ELOG)
But:  Validation des fichiers XML destines au systeme des journaux de bord electroniques du MPO (JBE)


xsd_start_date: 2022-06-13

-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <xs:simpleType name="integer">
        <xs:restriction base="xs:integer" >
            <xs:whiteSpace value="collapse"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="decimal">
        <xs:restriction base="xs:decimal">
            <xs:whiteSpace value="collapse"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="string">
        <xs:restriction base="xs:string">
            <xs:whiteSpace value="collapse"/>
            <xs:minLength value="1"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="string_6">
        <xs:restriction base="string">
            <xs:maxLength value="6"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="string_10">
        <xs:restriction base="string">
            <xs:maxLength value="10"/>
        </xs:restriction>
    </xs:simpleType>
    
    <xs:simpleType name="string_12">
        <xs:restriction base="string">
            <xs:maxLength value="12"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="string_15">
        <xs:restriction base="string">
            <xs:maxLength value="15"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="string_18">
        <xs:restriction base="string">
            <xs:maxLength value="18"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="string_20">
        <xs:restriction base="string">
            <xs:maxLength value="20"/>
        </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="string_25">
        <xs:restriction base="string">
            <xs:maxLength value="25"/>
        </xs:restriction>
    </xs:simpleType>
    
    <xs:simpleType name="string_30">
        <xs:restriction base="string">
            <xs:maxLength value="30"/>
        </xs:restriction>
    </xs:simpleType>   
    
    <xs:simpleType name="string_40">
        <xs:restriction base="string">
            <xs:maxLength value="40"/>
        </xs:restriction>
    </xs:simpleType>
    
    <xs:simpleType name="string_50">
        <xs:restriction base="string">
            <xs:maxLength value="50"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="string_80">
        <xs:restriction base="string">
            <xs:maxLength value="80"/>
        </xs:restriction>
    </xs:simpleType>
 
     <xs:simpleType name="string_100">
        <xs:restriction base="string">
            <xs:maxLength value="100"/>
        </xs:restriction>
    </xs:simpleType>

     <xs:simpleType name="string_150">
        <xs:restriction base="string">
            <xs:maxLength value="150"/>
        </xs:restriction>
    </xs:simpleType>
    
    <xs:simpleType name="string_200">
        <xs:restriction base="string">
            <xs:maxLength value="200"/>
        </xs:restriction>
    </xs:simpleType>      

    <xs:simpleType name="string_2000">
        <xs:restriction base="string">
            <xs:maxLength value="2000"/>
        </xs:restriction>
    </xs:simpleType>    
    
    <xs:simpleType name="ind_yn">
        <xs:restriction base="string">
            <xs:maxLength value="1"/>
            <xs:pattern value="[Y|N]"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="date_8">
        <xs:restriction base="integer">
            <xs:pattern value="[0-9]{4}(((0[13578]|(10|12))(0[1-9]|[1-2][0-9]|3[0-1]))|(02(0[1-9]|[1-2][0-9]))|((0[469]|11)(0[1-9]|[1-2][0-9]|30)))"/>
            <xs:minInclusive value="20210101"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="date_12">
        <xs:restriction base="integer">
            <xs:pattern value="[0-9]{4}(((0[13578]|(10|12))(0[1-9]|[1-2][0-9]|3[0-1]))|(02(0[1-9]|[1-2][0-9]))|((0[469]|11)(0[1-9]|[1-2][0-9]|30)))([0-1][0-9]|[2][0-3])([0-5][0-9])"/>
            <xs:minInclusive value="202101010000"/>  
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="date_14">
        <xs:restriction base="integer">
       <xs:pattern value="[0-9]{4}(((0[13578]|(10|12))(0[1-9]|[1-2][0-9]|3[0-1]))|(02(0[1-9]|[1-2][0-9]))|((0[469]|11)(0[1-9]|[1-2][0-9]|30)))([0-1][0-9]|[2][0-3])([0-5][0-9])([0-5][0-9])"/>
            <xs:minInclusive value="20210101000000"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="integer_1">
        <xs:restriction base="integer">
            <xs:minInclusive value="1"/>
            <xs:maxInclusive value="9"/>
        </xs:restriction>
    </xs:simpleType>
    
    <xs:simpleType name="integer_2">
        <xs:restriction base="integer">
            <xs:minInclusive value="1"/>
            <xs:maxInclusive value="99"/>
        </xs:restriction>
    </xs:simpleType>    

    <xs:simpleType name="integer_3">
        <xs:restriction base="integer">
            <xs:minInclusive value="1"/>
            <xs:maxInclusive value="999"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="integer_03">
        <xs:restriction base="integer">
            <xs:minInclusive value="0"/>
            <xs:maxInclusive value="999"/>
        </xs:restriction>
    </xs:simpleType>
    
    <xs:simpleType name="integer_6">
        <xs:restriction base="integer">
            <xs:minInclusive value="1"/>
            <xs:maxInclusive value="999999"/>
        </xs:restriction>
    </xs:simpleType>
   
    <xs:simpleType name="integer_4">
        <xs:restriction base="integer">
            <xs:minInclusive value="1"/>
            <xs:maxInclusive value="9999"/>
        </xs:restriction>
    </xs:simpleType>
    
    <xs:simpleType name="integer_04">
        <xs:restriction base="integer">
            <xs:minInclusive value="0"/>
            <xs:maxInclusive value="9999"/>
        </xs:restriction>
    </xs:simpleType>    

    <xs:simpleType name="integer_05">
        <xs:restriction base="integer">
            <xs:minInclusive value="0"/>
            <xs:maxInclusive value="99999"/>
        </xs:restriction>
    </xs:simpleType>   
    
    <xs:simpleType name="integer_06">
        <xs:restriction base="integer">
            <xs:minInclusive value="0"/>
            <xs:maxInclusive value="999999"/>
        </xs:restriction>
    </xs:simpleType> 

    <xs:simpleType name="integer_5">
        <xs:restriction base="integer">
            <xs:minInclusive value="1"/>
            <xs:maxInclusive value="99999"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="integer_10">
        <xs:restriction base="integer">
            <xs:minInclusive value="1"/>
            <xs:maxInclusive value="9999999999"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="number_1_1">
        <xs:restriction base="decimal">
            <xs:pattern value="([0-9]{1}\.[0-9]{1})"/>
            <xs:minInclusive value="0"/>
            <xs:maxInclusive value="9.9"/>
        </xs:restriction>
    </xs:simpleType>
    
    <xs:simpleType name="number_2_1">
        <xs:restriction base="decimal">
            <xs:pattern value="([0-9]{1,2}|[0-9]{1,2}\.[0-9]{1})"/>
            <xs:minInclusive value="0"/>
            <xs:maxInclusive value="99.9"/>
        </xs:restriction>
    </xs:simpleType>
    
    <xs:simpleType name="number_3_1">
        <xs:restriction base="decimal">
            <xs:pattern value="([0-9]{1,3}|[0-9]{1,3}\.[0-9]{1})"/>
            <xs:minInclusive value="0"/>
            <xs:maxInclusive value="999.9"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="number_4_2">
        <xs:restriction base="decimal">
            <xs:pattern value="([0-9]{1,4}|[0-9]{1,4}\.[0-9]{1,2})"/>
            <xs:minInclusive value="0"/>
            <xs:maxInclusive value="9999.99"/>
        </xs:restriction>
    </xs:simpleType>
        
    <xs:simpleType name="number_7_2">
        <xs:restriction base="decimal">
            <xs:pattern value="([0-9]{1,7}|[0-9]{1,7}\.[0-9]{1,2})"/>
            <xs:minInclusive value="0"/>
            <xs:maxInclusive value="9999999.99"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="nb_spcmn">
        <xs:restriction base="integer">
            <xs:minInclusive value="0"/>
            <xs:maxInclusive value="9999"/>
        </xs:restriction>
    </xs:simpleType> 

    <xs:simpleType name="modeType">
      <xs:restriction base="xs:string">
        <xs:enumeration value="M" />
        <xs:enumeration value="G" />
      </xs:restriction>
    </xs:simpleType>

    <xs:complexType name="latitude">
        <xs:simpleContent>
            <xs:restriction base="AttType">
               <xs:pattern value="([0-9]{2}|([0-9]{2}\.{0,1}[0-9]{1,4}))"/>
               <xs:minInclusive value="40"/>
               <xs:maxInclusive value="70"/>
            </xs:restriction>
        </xs:simpleContent>
    </xs:complexType>
    
    <xs:complexType name="longitude">
        <xs:simpleContent>
            <xs:restriction base="AttType">
               <xs:pattern value="(-[0-9]{2,3}|(-[0-9]{2,3}\.{0,1}[0-9]{1,4}))"/>
               <xs:minInclusive value="-165"/>
               <xs:maxInclusive value="-35"/>
            </xs:restriction>
        </xs:simpleContent>
    </xs:complexType>
    
    <xs:complexType name="AttType">
        <xs:simpleContent>
            <xs:extension base="xs:decimal">
                <xs:attribute name="MODE" type="modeType" use="required"/>
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>

    <xs:simpleType name="weight">
        <xs:restriction base="decimal">
            <xs:pattern value="([0-9]{1,6}|[0-9]{1,6}\.[0-9]{1,3})"/>
            <xs:minInclusive value="0"/>
            <xs:maxInclusive value="999999.999"/>
        </xs:restriction>
    </xs:simpleType>    
    
    <xs:simpleType name="dpth">
        <xs:restriction base="integer">
            <xs:minInclusive value="1"/>
            <xs:maxInclusive value="5000"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="air_temp">
        <xs:restriction base="integer">
             <xs:pattern value="0|[1-4][0-9]{0,1}|-[1-7][0-9]{0,1}"/>
            <xs:minInclusive value="-70"/>
            <xs:maxInclusive value="40"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="wtr_srf_temp">
        <xs:restriction base="integer">
            <xs:pattern value="0|[1-4][0-9]{0,1}|-[1-5]"/>
            <xs:minInclusive value="-5"/>
            <xs:maxInclusive value="40"/>
        </xs:restriction>
    </xs:simpleType>    

    <xs:complexType name="general_info_type">
       <xs:sequence>
        <xs:element name="CIE_ID"                minOccurs="1" maxOccurs="1" type="integer_10"/>
        <xs:element name="SOFT_VER"              minOccurs="1" maxOccurs="1" type="string_20"/>
        <xs:element name="REG_ID"                minOccurs="1" maxOccurs="1" type="integer_10"/>
        <xs:element name="FIN"                   minOccurs="0" maxOccurs="1" type="string_20"/>
        <xs:element name="VRN"                   minOccurs="0" maxOccurs="1" type="string_12"/>
        <xs:element name="FORM_VER_ID"           minOccurs="1" maxOccurs="1" type="integer_10"/>
       </xs:sequence>                         
       <xs:attribute name="NODE_ID" type="integer"/>
    </xs:complexType>

    <xs:complexType name="report_type">
       <xs:sequence>
        <xs:element name="REPORT_UID"            minOccurs="1" maxOccurs="1" type="string_6"/>
        <xs:element name="LOGBOOK_UID_REFERED"   minOccurs="0" maxOccurs="1" type="string_6"/>
        <xs:element name="DG_CLOSE_DT"           minOccurs="1" maxOccurs="1" type="date_14"/>
        <xs:element name="REM"                   minOccurs="0" maxOccurs="1" type="string_2000"/>

        <xs:element name="REPORT_DTL"             minOccurs="1" maxOccurs="unbounded" type="report_dtl_type"/>
       </xs:sequence>
       <xs:attribute name="NODE_ID" type="integer"/>
    </xs:complexType>

    <xs:complexType name="report_dtl_type">
       <xs:sequence>
        <xs:element name="START_DT"              minOccurs="1" maxOccurs="1" type="date_12"/>
        <xs:element name="END_DT"                minOccurs="1" maxOccurs="1" type="date_12"/>
        <xs:element name="LIC_NO"                minOccurs="1" maxOccurs="1" type="string_18"/>
        <xs:element name="REASON"                minOccurs="1" maxOccurs="1" type="string_2000"/>
        <xs:element name="REM"                   minOccurs="0" maxOccurs="1" type="string_2000"/>
       </xs:sequence>
    </xs:complexType>

    <xs:element name="ELOG">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="GENERAL_INFO"  minOccurs="1" maxOccurs="1"         type="general_info_type"/>
                <xs:element name="REPORT"        minOccurs="1" maxOccurs="unbounded" type="report_type"/>
            </xs:sequence>
            <xs:attribute name="NODE_ID" type="integer"/>
        </xs:complexType>
    </xs:element>
</xs:schema>