﻿<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           attributeFormDefault="unqualified"
           elementFormDefault="qualified"
           targetNamespace="http://www.retroplatform.com"
           xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:element name="rp9">
    <xs:complexType>
      <xs:sequence>

        <xs:element name="requirements">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="host" type="xs:string" />
              <xs:element name="playerversion" type="xs:string" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>

        <xs:element name="application">
          <xs:complexType>
            <xs:sequence>

              <xs:element name="description">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element minOccurs="0" name="entity">
                      <xs:complexType>
                        <xs:simpleContent>
                          <xs:extension base="xs:string">
                            <xs:attribute name="oid" type="xs:string" use="optional" />
                          </xs:extension>
                        </xs:simpleContent>
                      </xs:complexType>
                    </xs:element>
                    <xs:element minOccurs="0" name="genre" type="xs:string" />
                    <xs:element minOccurs="0" name="most-common-edition" type="xs:string" />
                    <xs:element minOccurs="0" name="homepage" type="xs:anyURI" />
                    <xs:element minOccurs="0" name="rating" type="xs:unsignedByte" />
                    <xs:element name="title" type="xs:string" />
                    <xs:element minOccurs="0" name="tosec-extended" type="xs:string" />
                    <xs:element minOccurs="0" name="type" type="xs:string" />
                    <xs:element minOccurs="0" name="version" type="xs:string" />
                    <xs:element minOccurs="0" name="year" type="xs:unsignedShort" />
                  </xs:sequence>
                </xs:complexType>
              </xs:element>

              <xs:element name="configuration">
                <xs:complexType>
                  <xs:sequence>
                    <xs:choice maxOccurs="unbounded">
                      <xs:element name="system" type="xs:string" />
                      <xs:element minOccurs="0" name="video" type="xs:string" />
                      <xs:element minOccurs="0" name="rom">
                        <xs:complexType>
                          <xs:simpleContent>
                            <xs:extension base="xs:string">
                              <xs:attribute name="type" type="xs:string" use="optional" />
                            </xs:extension>
                          </xs:simpleContent>
                        </xs:complexType>
                      </xs:element>
                      <xs:element minOccurs="0" maxOccurs="unbounded" name="ram">
                        <xs:complexType>
                          <xs:simpleContent>
                            <xs:extension base="xs:string">
                              <xs:attribute name="type" type="xs:string" use="optional" />
                            </xs:extension>
                          </xs:simpleContent>
                        </xs:complexType>
                      </xs:element>
                      <xs:element minOccurs="0" name="boot">
                        <xs:complexType>
                          <xs:simpleContent>
                            <xs:extension base="xs:string">
                              <xs:attribute name="readonly" type="xs:string" use="optional" />
                              <xs:attribute name="type" type="xs:string" use="optional" />
                            </xs:extension>
                          </xs:simpleContent>
                        </xs:complexType>
                      </xs:element>
                      <xs:element minOccurs="0" maxOccurs="unbounded" name="peripheral">
                        <xs:complexType>
                          <xs:simpleContent>
                            <xs:extension base="xs:string">
                              <xs:attribute name="type" type="xs:string" use="optional" />
                              <xs:attribute name="unit" type="xs:unsignedByte" use="optional" />
                              <xs:attribute name="speed" type="xs:string" use="optional" />
                              <xs:attribute name="memory" type="xs:unsignedInt" use="optional" />
                              <xs:attribute name="fpu" type="xs:boolean" use="optional" />
                              <xs:attribute name="path" type="xs:string" use="optional" />
                              <xs:attribute name="device" type="xs:string" use="optional" />
                              <xs:attribute name="devicename" type="xs:string" use="optional" />
                              <xs:attribute name="volumename" type="xs:string" use="optional" />
                            </xs:extension>
                          </xs:simpleContent>
                        </xs:complexType>
                      </xs:element>
                      <xs:element minOccurs="0" maxOccurs="unbounded" name="compatibility" type="xs:string" />
                      <xs:element minOccurs="0" name="clip">
                        <xs:complexType>
                          <xs:attribute name="left" type="xs:unsignedInt" use="required" />
                          <xs:attribute name="top" type="xs:unsignedInt" use="required" />
                          <xs:attribute name="width" type="xs:unsignedInt" use="required" />
                          <xs:attribute name="height" type="xs:unsignedInt" use="required" />
                        </xs:complexType>
                      </xs:element>
                    </xs:choice>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>

              <xs:element name="media">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element minOccurs="0" maxOccurs="unbounded" name="floppy" type="xs:string" />
                    <xs:element minOccurs="0" maxOccurs="unbounded" name="harddrive" type="xs:string" />
                    <xs:element minOccurs="0" maxOccurs="unbounded" name="cd" type="xs:string" />
                    <xs:element minOccurs="0" maxOccurs="unbounded" name="tape" type="xs:string" />
                    <xs:element minOccurs="0" maxOccurs="unbounded" name="snapshot" type="xs:string" />
                  </xs:sequence>
                </xs:complexType>
              </xs:element>

              <xs:element minOccurs="0" name="startup">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element minOccurs="0" name="load">
                      <xs:complexType>
                        <xs:simpleContent>
                          <xs:extension base="xs:string">
                            <xs:attribute name="auto" type="xs:boolean" use="optional" />
                          </xs:extension>
                        </xs:simpleContent>
                      </xs:complexType>
                    </xs:element>
                    <xs:element minOccurs="0" name="run">
                      <xs:complexType>
                        <xs:simpleContent>
                          <xs:extension base="xs:string">
                            <xs:attribute name="auto" type="xs:boolean" use="optional" />
                          </xs:extension>
                        </xs:simpleContent>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>

            </xs:sequence>
            <xs:attribute name="oid" type="xs:string" use="optional" />
            <xs:attribute name="score" type="xs:unsignedByte" use="optional" />
            <xs:attribute name="libraryversion" type="xs:decimal" use="optional" />
            <xs:attribute name="user-edited" type="xs:boolean" use="optional" />
          </xs:complexType>
        </xs:element>

      </xs:sequence>
    </xs:complexType>
  </xs:element>

</xs:schema>
