schema: Restricted enum item values
authorDaniel Martin <consume.noise@gmail.com>
Fri, 22 Nov 2013 22:26:54 +0000 (23:26 +0100)
committerDaniel Martin <consume.noise@gmail.com>
Sun, 20 Jul 2014 19:23:29 +0000 (21:23 +0200)
Restrict decimal values by using an xsd:unsignedInt instead of an
xsd:integer. xsd:unsignedInt is an unsigned 32-bit integer.
And restrict bit values by adding a type, which allows values within the
range of [0, 32) only.

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
src/xcb.xsd

index 77a696f..59bb9a8 100644 (file)
@@ -163,7 +163,7 @@ authorization from the authors.
         </xsd:complexType>
       </xsd:element>
       <xsd:element name="value" type="xsd:integer" />
-      <xsd:element name="bit" type="xsd:integer" />
+      <xsd:element name="bit" type="bitType" />
     </xsd:choice>
   </xsd:group>
   
@@ -224,6 +224,14 @@ authorization from the authors.
     <xsd:attribute name="ref" type="xsd:string" use="required" />
   </xsd:complexType>
 
+  <!-- Type for bit values -->
+  <xsd:simpleType name="bitType">
+    <xsd:restriction base="xsd:integer">
+      <xsd:minInclusive value="0" />
+      <xsd:maxExclusive value="32" />
+    </xsd:restriction>
+  </xsd:simpleType>
+
   <!-- Type for documentation -->
   <xsd:group name="doc-fields">
     <xsd:sequence>
@@ -352,8 +360,8 @@ authorization from the authors.
             <xsd:element name="item">
               <xsd:complexType>
                 <xsd:choice minOccurs="1" maxOccurs="1">
-                  <xsd:element name="value" type="xsd:integer" />
-                  <xsd:element name="bit" type="xsd:integer" />
+                  <xsd:element name="value" type="xsd:unsignedInt" />
+                  <xsd:element name="bit" type="bitType" />
                 </xsd:choice>
                 <xsd:attribute name="name" type="xsd:string" use="required" />
               </xsd:complexType>