<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XML Spy v4.3 U (http://www.xmlspy.com) by Kevin Pearcey (Amphora Research) -->
<xs:schema targetNamespace="http://www.censml.org/censml-v2" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.censml.org/censml-v2" elementFormDefault="unqualified" attributeFormDefault="unqualified">
  <xs:element name="CENSML">
    <xs:annotation>
      <xs:documentation>Root element for a CENSML experiment.</xs:documentation>
    </xs:annotation>
    <xs:complexType mixed="false">
      <xs:sequence>
        <xs:element name="metadata">
          <xs:annotation>
            <xs:documentation>Descriptive information about the experiment.</xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="id" type="xs:string">
                <xs:annotation>
                  <xs:documentation>Unique ID for this experiment.</xs:documentation>
                </xs:annotation>
              </xs:element>
              <xs:element name="title" type="xs:string">
                <xs:annotation>
                  <xs:documentation>The title for the experiment.</xs:documentation>
                </xs:annotation>
              </xs:element>
              <xs:element name="subject" type="xs:string" minOccurs="0">
                <xs:annotation>
                  <xs:documentation>Subject for the experiment.</xs:documentation>
                </xs:annotation>
              </xs:element>
              <xs:element name="description" type="xs:string" minOccurs="0">
                <xs:annotation>
                  <xs:documentation>Brief description of the experiment.</xs:documentation>
                </xs:annotation>
              </xs:element>
              <xs:element name="creator" type="auditType">
                <xs:annotation>
                  <xs:documentation>Audit record for the person who first created this experiment.</xs:documentation>
                </xs:annotation>
              </xs:element>
              <xs:element name="publisher" type="xs:string" minOccurs="0">
                <xs:annotation>
                  <xs:documentation>Name of the organisation producing the experiment.</xs:documentation>
                </xs:annotation>
              </xs:element>
              <xs:element name="contributor" type="auditType" minOccurs="0" maxOccurs="unbounded">
                <xs:annotation>
                  <xs:documentation>Audit record for a person who has edited this experiment.</xs:documentation>
                </xs:annotation>
              </xs:element>
              <xs:element name="custom" minOccurs="0" maxOccurs="unbounded">
                <xs:annotation>
                  <xs:documentation>Additional meta information specific to each application.</xs:documentation>
                </xs:annotation>
                <xs:complexType>
                  <xs:simpleContent>
                    <xs:extension base="xs:string">
                      <xs:attribute name="name" type="xs:string" use="required"/>
                    </xs:extension>
                  </xs:simpleContent>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="narrative" maxOccurs="unbounded">
          <xs:annotation>
            <xs:documentation>Narrative elements store the experimental data being recorded.</xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="title" type="xs:string">
                <xs:annotation>
                  <xs:documentation>The title for this narrative section.</xs:documentation>
                </xs:annotation>
              </xs:element>
              <xs:element name="client" type="xs:string">
                <xs:annotation>
                  <xs:documentation>Identifier for the client which last updated this narrative.</xs:documentation>
                </xs:annotation>
              </xs:element>
              <xs:element name="creator" type="auditType" minOccurs="0">
                <xs:annotation>
                  <xs:documentation>Audit record for the person who created this narrative section.</xs:documentation>
                </xs:annotation>
              </xs:element>
              <xs:element name="contributor" type="auditType" minOccurs="0">
                <xs:annotation>
                  <xs:documentation>Audit record for a person who has edited this narrative section.</xs:documentation>
                </xs:annotation>
              </xs:element>
              <xs:element name="version" type="xs:string" minOccurs="0">
                <xs:annotation>
                  <xs:documentation>Version number for this narrative section.</xs:documentation>
                </xs:annotation>
              </xs:element>
              <xs:element name="description" type="xs:string" minOccurs="0">
                <xs:annotation>
                  <xs:documentation>Brief description of the use for this narrative.</xs:documentation>
                </xs:annotation>
              </xs:element>
              <xs:element name="neutral">
                <xs:annotation>
                  <xs:documentation>A standardised format for the information in this narrative.</xs:documentation>
                </xs:annotation>
                <xs:complexType>
                  <xs:choice>
                    <xs:element name="xhtml" type="xhtmlType">
                      <xs:annotation>
                        <xs:documentation>XHTML formatted version of the narrative.</xs:documentation>
                      </xs:annotation>
                    </xs:element>
                    <xs:element name="png" type="xs:base64Binary">
                      <xs:annotation>
                        <xs:documentation>PNG Graphic of the narrative.</xs:documentation>
                      </xs:annotation>
                    </xs:element>
                  </xs:choice>
                </xs:complexType>
              </xs:element>
              <xs:element name="native" type="representationType" minOccurs="0">
                <xs:annotation>
                  <xs:documentation>If the neutral block does not provide a means to represent the client generated data, then the native element should be used to additionally store it for future access.</xs:documentation>
                </xs:annotation>
              </xs:element>
              <xs:element name="representation" type="representationType" minOccurs="0" maxOccurs="unbounded">
                <xs:annotation>
                  <xs:documentation>An alternative representation for the narratives native data.</xs:documentation>
                </xs:annotation>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="nid" type="xs:string" use="optional">
              <xs:annotation>
                <xs:documentation>Optional narrative id specific to the application generating the censml.</xs:documentation>
              </xs:annotation>
            </xs:attribute>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:complexType name="representationType">
    <xs:annotation>
      <xs:documentation>Representation information for an experiment field.</xs:documentation>
    </xs:annotation>
    <xs:choice>
      <xs:element name="xhtml" type="xhtmlType">
        <xs:annotation>
          <xs:documentation>XHTML mark up and any associated attachments (e.g. images)</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="binary">
        <xs:annotation>
          <xs:documentation>Raw binary information</xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:simpleContent>
            <xs:extension base="xs:base64Binary">
              <xs:attribute name="name" type="xs:string" use="required"/>
              <xs:attribute name="mimetype" type="xs:string" use="required"/>
            </xs:extension>
          </xs:simpleContent>
        </xs:complexType>
      </xs:element>
      <xs:element name="tabular">
        <xs:annotation>
          <xs:documentation>Simple tabular data in rows and columns</xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="headings" type="dataType" minOccurs="0">
              <xs:annotation>
                <xs:documentation>Optional heading information for the cells columns / rows.</xs:documentation>
              </xs:annotation>
            </xs:element>
            <xs:element name="data" type="dataType" maxOccurs="unbounded">
              <xs:annotation>
                <xs:documentation>A set of data for one row or column.</xs:documentation>
              </xs:annotation>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="markup">
        <xs:annotation>
          <xs:documentation>Any form of valid XML formatted data.</xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:any maxOccurs="unbounded">
              <xs:annotation>
                <xs:documentation>Any XML markup</xs:documentation>
              </xs:annotation>
            </xs:any>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:choice>
  </xs:complexType>
  <xs:complexType name="dataType">
    <xs:annotation>
      <xs:documentation>Common type for data in a single cell.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="cell" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>Value for the cell</xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:simpleContent>
            <xs:extension base="xs:string">
              <xs:attribute name="x" type="xs:string" use="optional">
                <xs:annotation>
                  <xs:documentation>X Grid reference.
</xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="y" type="xs:string" use="optional">
                <xs:annotation>
                  <xs:documentation>Y grid reference.
</xs:documentation>
                </xs:annotation>
              </xs:attribute>
            </xs:extension>
          </xs:simpleContent>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="auditType">
    <xs:annotation>
      <xs:documentation>Hold the name of a person and the data/time associated with an event (eg document creation).</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="name">
        <xs:annotation>
          <xs:documentation>Human readable name of the person / organisation.</xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:simpleContent>
            <xs:extension base="xs:string">
              <xs:attribute name="uid" type="xs:string" use="optional">
                <xs:annotation>
                  <xs:documentation>Optionally store a machine specific user id in addition to the human readable form.
</xs:documentation>
                </xs:annotation>
              </xs:attribute>
            </xs:extension>
          </xs:simpleContent>
        </xs:complexType>
      </xs:element>
      <xs:element name="timestamp" type="xs:dateTime">
        <xs:annotation>
          <xs:documentation>The data and time that the change was made.</xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="xhtmlType">
    <xs:annotation>
      <xs:documentation>Element structure to hold an XHTML document and any associated images.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="body">
        <xs:annotation>
          <xs:documentation>The XHTML markup. Any relative URI's are taken to be from the parent xhtml tag to match an attachment name below.</xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:any namespace="http://www.w3.org/1999/xhtml" minOccurs="0" maxOccurs="unbounded">
              <xs:annotation>
                <xs:documentation>Any XHTML markup.</xs:documentation>
              </xs:annotation>
            </xs:any>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="attachment" minOccurs="0" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>Additional data requireed for the narrative body such as inlie images. Need to review mimetype, png assumes only graphics but is this so.</xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:simpleContent>
            <xs:extension base="xs:base64Binary">
              <xs:attribute name="name" type="xs:string" use="required">
                <xs:annotation>
                  <xs:documentation>The referenced name for this attachment.
</xs:documentation>
                </xs:annotation>
              </xs:attribute>
              <xs:attribute name="mimetype" use="required">
                <xs:annotation>
                  <xs:documentation>The mimetype of the binary data.</xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:enumeration value="image/png"/>
                  </xs:restriction>
                </xs:simpleType>
              </xs:attribute>
            </xs:extension>
          </xs:simpleContent>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
</xs:schema>
