<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           version="1.2"
           >

  <xs:complexType name="ExtraType">	
    <xs:anyAttribute namespace="##any" processContents="lax" /> 
  </xs:complexType>

  <xs:simpleType name="nonNegativeDecimal">
    <xs:restriction base="xs:decimal"> 
      <xs:minInclusive value="0"/> 
    </xs:restriction> 
  </xs:simpleType>
  
  <xs:simpleType name="LoopIndexType">
    <xs:restriction base="xs:integer"> 
      <xs:minInclusive value="-1"/> 
    </xs:restriction> 
  </xs:simpleType>
  
  <xs:simpleType name="UUTStatusType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="Passed"/> 
      <xs:enumeration value="Failed"/> 
      <xs:enumeration value="Terminated"/> 
      <xs:enumeration value="Aborted"/> 
      <xs:enumeration value="Error"/> 
      <xs:enumeration value="Done"/> 
      <xs:enumeration value="Skipped"/> 
    </xs:restriction>
  </xs:simpleType>
      
  <xs:simpleType name="TestStatusType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="Passed"/> 
      <xs:enumeration value="Failed"/> 
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="RulesType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="EQ"/> 
      <xs:enumeration value="NE"/> 
      <xs:enumeration value="GT"/> 
      <xs:enumeration value="GE"/> 
      <xs:enumeration value="LT"/> 
      <xs:enumeration value="LE"/> 
      <xs:enumeration value="GTLT"/> 
      <xs:enumeration value="GTLE"/> 
      <xs:enumeration value="GELT"/> 
      <xs:enumeration value="GELE"/> 
      <xs:enumeration value="MATCH"/> 
      <xs:enumeration value="LOG"/> 
      <xs:enumeration value="NONE"/> 
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="RunModeType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="Production"/>
      <xs:enumeration value="Debug"/>
      <xs:enumeration value="Golden"/>
      <xs:enumeration value="SelfTest"/>
    </xs:restriction>
  </xs:simpleType>
 
   <xs:complexType name="BatchType">
    <xs:sequence>
      <xs:element name="FACTORY" 	type="FactoryType" 	minOccurs="1" maxOccurs="1"/>
      <xs:element name="PRODUCT"	type="ProductType" 	minOccurs="1" maxOccurs="1"/>
      <xs:element name="REFS"		type="RefsType"		minOccurs="1" maxOccurs="1"/>
      <xs:element name="EXTRA"		type="ExtraType"	minOccurs="0"/> 
      <xs:element name="PANEL"		type="PanelType" 	minOccurs="1"/>
    </xs:sequence>
    
    <xs:attribute name="TIMESTAMP" 	type="xs:string"	use="required"/>
    <xs:attribute name="SYNTAX_REV"	type="xs:string"	use="required"/>
    <xs:attribute name="COMPATIBLE_REV"	type="xs:string"	use="required"/>
  </xs:complexType>
  
  <xs:complexType name="FactoryType">
    <xs:attribute name="NAME" 				type="xs:string"		use="required"/>
    <xs:attribute name="LINE"					type="xs:string"		use="required"/>
    <xs:attribute name="TESTER" 			type="xs:string"		use="required"/>
    <xs:attribute name="FIXTURE" 			type="xs:string"		use="required"/>
    <xs:attribute name="SHIFT" 				type="xs:string"		use="required"/>
    <xs:attribute name="USER" 				type="xs:string"		use="required"/>
    <xs:attribute name="SYSTEMTYPE" 	type="xs:string"		use="required"/>
    <xs:attribute name="TESTCATEGORY" type="xs:string"	use="required"/>
  </xs:complexType>
  
  <xs:complexType name="ProductType">
    <xs:attribute name="NAME" 		type="xs:string"	use="required"/>
    <xs:attribute name="REVISION"	type="xs:string"	use="required"/>
    <xs:attribute name="FAMILY" 	type="xs:string"	use="required"/>
    <xs:attribute name="CUSTOMER" 	type="xs:string"	use="required"/>
  </xs:complexType>

  <xs:complexType name="RefsType">	
    <xs:attribute name="SEQ_REF" 	type="xs:string"	use="required"/>
    <xs:attribute name="FTS_REF"	type="xs:string"	use="required"/>
    <xs:attribute name="LIM_REF" 	type="xs:string"	use="required"/>
    <xs:attribute name="CFG_REF" 	type="xs:string"	use="required"/>
    <xs:attribute name="CAL_REF" 	type="xs:string"	use="required"/>
    <xs:attribute name="INSTR_REF" 	type="xs:string"	use="required"/>
  </xs:complexType>

  <xs:complexType name="sType">	
    <xs:anyAttribute namespace="##any" processContents="lax" /> 
  </xs:complexType>

  <xs:complexType name="PanelType">
    <xs:sequence>
      <xs:element name="DUT" 		type="DutType" 			minOccurs="1"/>
      <xs:element name="EXTRA"		type="ExtraType"		minOccurs="0"/> 
    </xs:sequence>
    
    <xs:attribute name="ID" 		type="xs:string"		use="required"/>
    <xs:attribute name="COMMENT"	type="xs:string"		use="required"/>
    <xs:attribute name="RUNMODE" 	type="RunModeType"		use="required"/>
    <xs:attribute name="TIMESTAMP" 	type="xs:string"		use="required"/>
    <xs:attribute name="TESTTIME" 	type="nonNegativeDecimal"	use="required"/>
    <xs:attribute name="WAITTIME" 	type="nonNegativeDecimal"	use="required"/>
    <xs:attribute name="STATUS" 	type="UUTStatusType"		use="required"/>
  </xs:complexType>
  
  <xs:complexType name="DutType">
    <xs:sequence>
      <xs:element name="GROUP" 		type="GroupType" 		minOccurs="0"/>
      <xs:element name="EXTRA"		type="ExtraType"		minOccurs="0"/> 
    </xs:sequence>

    <xs:attribute name="ID" 		type="xs:string"		use="required"/>
    <xs:attribute name="COMMENT"	type="xs:string"		use="required"/>
    <xs:attribute name="PANEL" 		type="xs:nonNegativeInteger"	use="required"/>
    <xs:attribute name="SOCKET" 	type="xs:nonNegativeInteger"	use="required"/>
    <xs:attribute name="TIMESTAMP" 	type="xs:string"		use="required"/>
    <xs:attribute name="TESTTIME" 	type="nonNegativeDecimal"	use="required"/>
    <xs:attribute name="STATUS" 	type="UUTStatusType"		use="required"/>
  </xs:complexType>
 
 
 
<!--
        Trick to allow GROUP and TEST element appear in random order
 	http://www.zvon.org/xxl/XMLSchemaTutorial/Output/ser_simpleContent_st5.html	 
 -->
  <xs:complexType name="GroupType" mixed="false"> 
      <xs:sequence 							minOccurs="0"	maxOccurs="unbounded"> 
        <xs:element name="GROUP"	type="GroupType"		minOccurs="0"/> 
        <xs:element name="TEST"		type="TestType"			minOccurs="0"/> 
        <xs:element name="EXTRA"	type="ExtraType"		minOccurs="0"/> 
      </xs:sequence> 


    <xs:attribute name="NAME" 		type="xs:string"		use="required"/>
    <xs:attribute name="STEPGROUP"	type="xs:string"		use="required"/>
    <xs:attribute name="GROUPINDEX" 	type="xs:nonNegativeInteger"	use="required"/>
    <xs:attribute name="LOOPINDEX" 	type="LoopIndexType"	use="required"/>
    <xs:attribute name="TYPE" 		type="xs:string"		use="required"/>
    <xs:attribute name="RESOURCE" 	type="xs:string"		use="required"/>
    <xs:attribute name="MODULETIME" 	type="nonNegativeDecimal"	use="required"/>
    <xs:attribute name="TOTALTIME" 	type="nonNegativeDecimal"	use="required"/>
    <xs:attribute name="TIMESTAMP" 	type="xs:string"		use="required"/>
    <xs:attribute name="STATUS" 	type="UUTStatusType"	use="required"/>
  </xs:complexType>
  
  <xs:complexType name="TestType">
    <xs:attribute name="NAME" 		type="xs:string"		use="required"/>
    <xs:attribute name="DESCRIPTION"	type="xs:string"		use="required"/>
    <xs:attribute name="UNIT" 		type="xs:string"		use="required"/>
    <xs:attribute name="VALUE" 		type="xs:string"		use="required"/>
    <xs:attribute name="HILIM" 		type="xs:string"		use="required"/>
    <xs:attribute name="LOLIM" 		type="xs:string"		use="required"/>
    <xs:attribute name="STATUS" 	type="TestStatusType"	use="required"/>
    <xs:attribute name="RULE" 		type="RulesType"		use="required"/>
    <xs:attribute name="TARGET" 	type="xs:string"		use="required"/>
    <xs:attribute name="DATATYPE" 	type="xs:string"		use="required"/>
  </xs:complexType>
  
  <xs:element name="BATCH" type="BatchType"/>

</xs:schema>
