<?xml version = "1.0" encoding = "UTF-8"?>
<!-- style sheet OFF -->
<!--
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    #
    # Copyright (C) 2003-2011 Open Microscopy Environment
    #       Massachusetts Institute of Technology,
    #       National Institutes of Health,
    #       University of Dundee,
    #       University of Wisconsin at Madison
    #
    # This work is licensed under the
    #       Creative Commons Attribution 3.0 Unported License.
    # To view a copy of this license, visit
    #       http://creativecommons.org/licenses/by/3.0/
    # or send a letter to
    #       Creative Commons, 444 Castro Street, Suite 900,
    #       Mountain View, California, 94041, USA.
    # For attribution instructions, visit
    #       http://www.openmicroscopy.org/info/attribution
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-->
<!--
	#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	# Written by:  Josiah Johnston <siah@nih.gov>, Andrew J Patterson
	#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-->
<xsd:schema 
	xmlns:xsd = "http://www.w3.org/2001/XMLSchema"
	targetNamespace = "http://www.openmicroscopy.org/Schemas/BinaryFile/2011-06"
	xmlns:Bin = "http://www.openmicroscopy.org/Schemas/BinaryFile/2011-06"
	xmlns:OME = "http://www.openmicroscopy.org/Schemas/OME/2011-06"
	xmlns:xml="http://www.w3.org/XML/1998/namespace"
	version = "1"
	elementFormDefault = "qualified">
	<xsd:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/>
	<xsd:import namespace="http://www.openmicroscopy.org/Schemas/OME/2011-06" schemaLocation="http://www.openmicroscopy.org/Schemas/OME/2011-06/ome.xsd"/>
	<xsd:annotation>
		<xsd:documentation>
			The elements in this file are not yet represented by classes in the EA diagrams - ajp
		</xsd:documentation>
	</xsd:annotation>
	<xsd:element name = "External"> <!-- top level definition -->
		<xsd:annotation>
			<xsd:documentation>Describes a file location.  Can optionally specify a portion of a file using Offset and a ReadLength.
If Offset and ReadLength are specified in conjuction with Compression, then they point into the uncompressed file.
			</xsd:documentation>
		</xsd:annotation>
		<xsd:complexType>
			<xsd:attribute name = "href" use = "required" type = "xsd:anyURI">
				<xsd:annotation>
					<xsd:documentation>file location</xsd:documentation>
				</xsd:annotation>
			</xsd:attribute>
			<xsd:attribute name = "SHA1" use = "required" type = "Bin:Hex40">
				<xsd:annotation>
					<xsd:documentation>The digest of the file specified in href.</xsd:documentation>
				</xsd:annotation>
			</xsd:attribute>
			<xsd:attribute name = "Compression" default = "none" use="optional">
				<xsd:annotation>
					<xsd:documentation>Specifies the compression scheme used to encode the data.</xsd:documentation>
				</xsd:annotation>
				<xsd:simpleType>
					<xsd:restriction base = "xsd:string">
						<xsd:enumeration value = "zlib"/>
						<xsd:enumeration value = "bzip2"/>
						<xsd:enumeration value = "none"/>
					</xsd:restriction>
				</xsd:simpleType>
			</xsd:attribute>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name = "BinData"> <!-- top level definition -->
		<xsd:annotation>
			<xsd:documentation>The contents of this element are base64-encoded.  These are not CDATA sections, just a base64 stream.</xsd:documentation>
		</xsd:annotation>
		<xsd:complexType>
			<xsd:simpleContent>
				<xsd:extension base = "xsd:base64Binary">
					<xsd:attribute name = "Compression" default = "none" use="optional">
						<xsd:annotation>
							<xsd:documentation>Specifies the compression scheme used to encode the data. </xsd:documentation>
						</xsd:annotation>
						<xsd:simpleType>
							<xsd:restriction base = "xsd:string">
								<xsd:enumeration value = "zlib"/>
								<xsd:enumeration value = "bzip2"/>
								<xsd:enumeration value = "none"/>
							</xsd:restriction>
						</xsd:simpleType>
					</xsd:attribute>
					<xsd:attribute name="BigEndian" use="required" type="xsd:boolean">
						<xsd:annotation>
							<xsd:documentation>
								This is true if the binary data was written in BigEndian order. This is dependent on the system architecture of the machine that wrote the pixels. True for essentially all modern CPUs other than Intel and Alpha. All Binary data must be written in the same endian order.
							</xsd:documentation>
						</xsd:annotation>
					</xsd:attribute>
					<xsd:attribute name="Length" use="required">
						<xsd:annotation>
							<xsd:documentation>
								Character count attribute for the BinData field. This is the length of the base-64 encoded block. It allows easy skipping of the block when parsing the file.
							</xsd:documentation>
						</xsd:annotation>
						<xsd:simpleType>
							<xsd:restriction base="OME:NonNegativeLong">
							</xsd:restriction>
						</xsd:simpleType>
					</xsd:attribute>
				</xsd:extension>
			</xsd:simpleContent>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name = "BinaryFile"> <!-- top level definition -->
		<xsd:annotation>
			<xsd:documentation>Describes a binary file.</xsd:documentation>
		</xsd:annotation>
		<xsd:complexType>
			<xsd:choice minOccurs="1" maxOccurs="1">
				<xsd:element ref="Bin:External" minOccurs="1" maxOccurs="1"/>
				<xsd:element ref="Bin:BinData" minOccurs="1" maxOccurs="1"/>
			</xsd:choice>
			<xsd:attribute name ="FileName" use="required" type="xsd:string"/>
			<xsd:attribute name ="Size" use="required" type="OME:NonNegativeLong">
				<xsd:annotation>
					<xsd:documentation>
						Size (in bytes) of the uncompressed file.
					</xsd:documentation>
				</xsd:annotation>
			</xsd:attribute>
			<xsd:attribute name="MIMEType" use="optional" type="xsd:string"/>	
		</xsd:complexType>
	</xsd:element>
	<xsd:simpleType name = "Hex40">
		<xsd:restriction base = "xsd:hexBinary">
			<xsd:length value = "20"/>
		</xsd:restriction>
	</xsd:simpleType>
</xsd:schema>

