Skip to content

Instantly share code, notes, and snippets.

@nfarring
Created September 4, 2011 06:30
Show Gist options
  • Save nfarring/1192391 to your computer and use it in GitHub Desktop.
Save nfarring/1192391 to your computer and use it in GitHub Desktop.
Barcode XML Schema
<xs:simpleType name="UPC-E-Barcode">
<xs:annotation>
<xs:documentation>
Reference: http://www.barcodeisland.com/upce.phtml
The UPC-E barcode has 7 digits.
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:token">
<xs:pattern value="[0-9]{7}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="EAN-8-Barcode">
<xs:annotation>
<xs:documentation>
Reference: http://www.barcodeisland.com/ean8.phtml
The EAN-8 barcode has 8 digits.
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:token">
<xs:pattern value="[0-9]{8}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="UPC-A-Barcode">
<xs:annotation>
<xs:documentation>
Reference: http://www.barcodeisland.com/upca.phtml
The UPC-A barcode has 12 digits.
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:token">
<xs:pattern value="[0-9]{12}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="EAN-13-Barcode">
<xs:annotation>
<xs:documentation>
Reference: http://www.barcodeisland.com/ean13.phtml
The EAN-13 barcode has 13 digits.
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:token">
<xs:pattern value="[0-9]{13}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="UPC-2-Barcode">
<xs:annotation>
<xs:documentation>
Reference: http://www.barcodeisland.com/upcext.phtml
The UPC 2-Digit supplement barcode has 2 digits.
It is found to the right of a longer UPC-A or EAN-13 barcode.
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:token">
<xs:pattern value="[0-9]{2}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="UPC-5-Barcode">
<xs:annotation>
<xs:documentation>
Reference: http://www.barcodeisland.com/upcext.phtml
The UPC 5-Digit supplement barcode has 5 digits.
It is found to the right of a longer UPC-A or EAN-13 barcode.
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:token">
<xs:pattern value="[0-9]{5}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="Barcode">
<xs:annotation>
<xs:documentation>
A barcode is one of the more specific barcode types.
The type is deduced from the number of digits in the barcode.
</xs:documentation>
</xs:annotation>
<xs:union memberTypes="UPC-E-Barcode EAN-8-Barcode UPC-A-Barcode EAN-13-Barcode UPC-2-Barcode UPC-5-Barcode"/>
</xs:simpleType>
<xs:simpleType name="Barcodes">
<xs:annotation>
<xs:documentation>
Multiple barcodes separated with whitespace.
Example: 759606057610 00111
</xs:documentation>
</xs:annotation>
<xs:list itemType="Barcode"/>
</xs:simpleType>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment