<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
		   xmlns:this="http://www.w3.org/2009/xmlschema-ref-test-results"
		   targetNamespace="http://www.w3.org/2009/xmlschema-ref-test-results" 
		   elementFormDefault="qualified" 
>

  <xs:element name="results">
	<xs:annotation>
	  <xs:documentation>
		Root of the report of results.
	  </xs:documentation>
	</xs:annotation>
    <xs:complexType>
      <xs:sequence>
		<xs:element ref="this:implementation"/>
        <xs:element maxOccurs="unbounded" ref="this:testcase"/>
      </xs:sequence>
      <xs:attribute name="testSuiteVersion" use="required">      
		<xs:annotation>
		  <xs:documentation>
			Testsuite version number.
		  </xs:documentation>
		</xs:annotation>
	  </xs:attribute>
    </xs:complexType>
  </xs:element>
  
  <xs:simpleType name="schema-version">
	<xs:annotation>
	  <xs:documentation>
		Supported version of XML Schema, either 1.0 or 1.1.
	  </xs:documentation>
	</xs:annotation>
	<xs:restriction base="xs:string">
	  <xs:enumeration value="1.0"/>
	  <xs:enumeration value="1.1"/>
	</xs:restriction>
  </xs:simpleType>

  <xs:element name="name" type="xs:string">
	<xs:annotation>
	  <xs:documentation>
        The name of the implementation.
	  </xs:documentation>
	</xs:annotation>
  </xs:element>

  <xs:element name="implementation">
	<xs:annotation>
	  <xs:documentation>
		Information about the implementation.
	  </xs:documentation>
	</xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="this:name"/>
		<xs:element ref="this:comment" minOccurs="0" maxOccurs="unbounded">
		  <xs:annotation>
			<xs:documentation>
			  Please provide comment blocks explaining how the implementation
			  manages the non-path part of a full designator (if applicable),
			  namespace context, and so on.
			</xs:documentation>
		  </xs:annotation>
		</xs:element>
	  </xs:sequence>
	  <xs:attribute name="schema-version" type="this:schema-version" use="required">
		<xs:annotation>
		  <xs:documentation>
			Which version of XML Schema the implementation used to run the tests.
		  </xs:documentation>
		</xs:annotation>
	  </xs:attribute>
	  <xs:attribute name="xpointer" type="xs:boolean" use="required">
		<xs:annotation>
		  <xs:documentation>
			Does the implementation support XPointer designators?
		  </xs:documentation>
		</xs:annotation>
	  </xs:attribute>
	  <xs:attribute name="date" type="xs:date" use="required">
		<xs:annotation>
		  <xs:documentation>
             Date of the report.
		  </xs:documentation>
		</xs:annotation>
	  </xs:attribute>
	  <xs:attribute name="testSuiteVersion" type="xs:string" use="required">
		<xs:annotation>
		  <xs:documentation>
            Version number of the testsuite.  Should match testSuiteVersion in
            the catalog.
		  </xs:documentation>
		</xs:annotation>
	  </xs:attribute>
    </xs:complexType>
  </xs:element>

  <xs:element name="testcase">
	<xs:annotation>
	  <xs:documentation>
		Report on a specific test case.
	  </xs:documentation>
	</xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" ref="this:comment"/>        
      </xs:sequence>
      <xs:attribute name="name" type="this:name" use="required"/>
	  <xs:attribute name="processing-kind" type="this:processing-kind" use="required"/>
	  <xs:attribute name="outcome" type="this:outcome" use="required"/>
    </xs:complexType>
  </xs:element>

  <xs:element name="comment" type="xs:string">
	<xs:annotation>
	  <xs:documentation>
		Human-consumable comment.
	  </xs:documentation>
	</xs:annotation>
  </xs:element>

  <xs:simpleType name="name">
	<xs:annotation>
	  <xs:documentation>
		The name of the test. 
	  </xs:documentation>
	</xs:annotation>
	<xs:restriction base="xs:NCName"/>
  </xs:simpleType>

  <xs:simpleType name="processing-kind">
	<xs:annotation>
	  <xs:documentation>
		The type of SCP processing being reported, one of 
		csg (canonical SCP generation),  cgi (canonical SCP interpretation), 
		ncsg (non-canonical SCP generation), or
		ncsi (non-canonical SCP interpretion).  An implementation may report 
		results of various kinds for a particular testcase, with the appropriate
		choice for each separate report.
	  </xs:documentation>
	</xs:annotation>
	<xs:restriction base="xs:token">
	  <xs:enumeration value="csg"/>
	  <xs:enumeration value="cgi"/>
	  <xs:enumeration value="ncsg"/>
	  <xs:enumeration value="ncgi"/>
	</xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="outcome">
	<xs:annotation>
	  <xs:documentation>
		Did the test succeed or fail? How to determine success or failure is 
		described in the instructions.
	  </xs:documentation>
	</xs:annotation>
	<xs:restriction base="xs:token">
	  <xs:enumeration value="success"/>
	  <xs:enumeration value="failure"/>
	  <xs:enumeration value="not-tested"/>
	</xs:restriction>
  </xs:simpleType>

  <xs:element name="details">
	<xs:annotation>
	  <xs:documentation>
		Reported differences for a generation test between the expected paths 
		and the paths that were actually generated.  This information is not
		required, but will prove helpful to identify areas of common difficulty,
		if any.
	  </xs:documentation>
	</xs:annotation>
    <xs:complexType>
	  <xs:sequence>
		<xs:element ref="this:path" minOccurs="0" maxOccurs="unbounded"/>
	  </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:element name="path">
	<xs:annotation>
	  <xs:documentation>
		A path difference.
	  </xs:documentation>
	</xs:annotation>
    <xs:complexType>
	  <xs:simpleContent>
		<xs:extension base="xs:string">
		  <xs:attribute name="change" use="required" type="this:change"/>
		</xs:extension>
	  </xs:simpleContent>
    </xs:complexType>
  </xs:element>
  
  <xs:simpleType name="change">
	<xs:annotation>
	  <xs:documentation>
		What kind of difference? 'add' means an addition to the baseline;
		'del' means something missing that was in the baseline.
	  </xs:documentation>
	</xs:annotation>
	<xs:restriction base="xs:token">
	  <xs:enumeration value="add"/>
	  <xs:enumeration value="del"/>
	</xs:restriction>
  </xs:simpleType>

</xs:schema>
