Device Class File Schema Definition

The following XML Schema Definition (XSD) defines the structure for an IzoT device class file.

<?xml version="1.0" encoding="UTF-8" ?>

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

  <xs:element name="attribute">
    <xs:complexType>
      <xs:choice>
        <xs:element ref="enum" />
        <xs:element ref="nvs" />
      </xs:choice>
      <xs:attribute name="name" type="xs:NMTOKEN" use="required" />
      <xs:attribute name="length" type="xs:NMTOKEN" use="optional" />
      <xs:attribute name="enum" use="optional" >
        <xs:simpleType>
          <xs:restriction base="xs:NMTOKEN">
            <xs:pattern value="true|false" />
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute name="scale" type="xs:NMTOKEN" use="optional" />
      <xs:attribute name="value" type="xs:NMTOKEN" use="optional" />
    </xs:complexType>
  </xs:element>

  <xs:element name="attributes">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="attribute" maxOccurs="unbounded" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:element name="byte">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="attribute" minOccurs="0" maxOccurs="unbounded" />
      </xs:sequence>
        <xs:attribute name="index" use="required" >
          <xs:simpleType>
            <xs:restriction base="xs:nonNegativeInteger">
              <xs:minInclusive value="0" />
              <xs:maxInclusive value="4095" />
            </xs:restriction>
          </xs:simpleType> 
      </xs:attribute>       
      <xs:attribute name="length" type="xs:NMTOKEN" use="optional" />
      <xs:attribute name="value" type="xs:NMTOKEN" use="optional" />    
    </xs:complexType>
  </xs:element>

  <xs:element name="device">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="attributes" />
        <xs:element ref="nvs" />
      </xs:sequence>
      <xs:attribute name="pid" use="required" >
        <xs:simpleType>
          <xs:restriction base="xs:hexBinary">
            <xs:length value="16" />
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>     
      <xs:attribute name="name" type="xs:string" use="required" />
      <xs:attribute name="type" type="xs:NMTOKEN" use="required" />
      <xs:attribute name="brand" type="xs:string" use="optional" />
    </xs:complexType>
  </xs:element>

  <xs:element name="enum">
    <xs:complexType>
      <xs:attribute name="output" type="xs:NMTOKEN" use="optional" />
      <xs:attribute name="input" type="xs:NMTOKEN" use="required" />
      <xs:attribute name="value" type="xs:NMTOKEN" use="optional" />
    </xs:complexType>
  </xs:element>
 
  <xs:element name="nv">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="byte" minOccurs="0" maxOccurs="unbounded" />
      </xs:sequence>
      <xs:attribute name="index" use="required" >
        <xs:simpleType>
          <xs:restriction base="xs:nonNegativeInteger">
            <xs:minInclusive value="0" />
            <xs:maxInclusive value="4095" />
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>       
      <xs:attribute name="size" type="xs:NMTOKEN" use="optional" />
      <xs:attribute name="direction" use="required" >
        <xs:simpleType>
          <xs:restriction base="xs:NMTOKEN">
            <xs:enumeration value="input" />
            <xs:enumeration value="output" />
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute name="type" type="xs:NMTOKEN" use="optional" />     
    </xs:complexType>
  </xs:element>

  <xs:element name="nvs">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="nv" maxOccurs="4095" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>

</xs:schema>