<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:complexType name="relatedType">
    <xs:simpleContent>
        <xs:extension base="xs:string">
            <xs:attribute type="xs:string" name="count" use="optional"/>
            <xs:attribute type="xs:string" name="exclude" use="optional"/>
            <xs:attribute type="xs:string" name="attach" use="optional"/>
        </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
  <xs:element name="cockatrice_carddatabase">
    <xs:complexType>
      <xs:all>
        <xs:element name="sets" minOccurs="0">
            <xs:complexType>
                <xs:sequence>
                    <xs:element name="set" maxOccurs="unbounded" minOccurs="0">
                        <xs:complexType>
                            <xs:all>
                                <xs:element type="xs:string" name="name" minOccurs="1" maxOccurs="1"/>
                                <xs:element type="xs:string" name="longname" minOccurs="0" maxOccurs="1" />
                                <xs:element type="xs:string" name="settype" minOccurs="0" maxOccurs="1"/>
                                <xs:element type="xs:string" name="releasedate" minOccurs="0" maxOccurs="1"/>
                            </xs:all>
                        </xs:complexType>
                    </xs:element>
                </xs:sequence>
            </xs:complexType>
        </xs:element>
        <xs:element name="cards" minOccurs="0">
            <xs:complexType>
                <xs:sequence>
                    <xs:element name="card" maxOccurs="unbounded" minOccurs="0">
                        <xs:complexType>
                            <xs:sequence>
                                    <xs:element type="xs:string" name="name" />
                                    <xs:element name="set" maxOccurs="unbounded" minOccurs="1">
                                        <xs:complexType>
                                            <xs:simpleContent>
                                                <xs:extension base="xs:string">
                                                    <xs:attribute type="xs:int" name="muId" use="optional" />
                                                    <xs:attribute type="xs:string" name="uuId"  use="optional" />
                                                    <xs:attribute type="xs:anyURI" name="picURL" use="optional" />
                                                    <xs:attribute type="xs:string" name="num"  use="optional" />
                                                    <xs:attribute type="xs:string" name="rarity" use="optional" />
                                                </xs:extension>
                                            </xs:simpleContent>
                                        </xs:complexType>
                                    </xs:element>
                                    <xs:element type="xs:string" name="color" minOccurs="0" maxOccurs="5" />
                                    <xs:element type="relatedType" name="related" minOccurs="0" maxOccurs="unbounded" />
                                    <xs:element type="xs:string" name="manacost" minOccurs="0" maxOccurs="1" />
                                    <xs:element type="xs:string" name="cmc" minOccurs="0" maxOccurs="1" default="0" />
                                    <xs:element type="xs:string" name="type" minOccurs="1" maxOccurs="1" />
                                    <xs:element type="xs:string" name="pt" minOccurs="0" maxOccurs="1" />
                                    <xs:element type="xs:integer" name="tablerow" maxOccurs="1" />
                                    <xs:element type="xs:string" name="text" minOccurs="0" maxOccurs="1" />
                                    <xs:element type="xs:boolean" name="cipt" minOccurs="0" maxOccurs="1" />
                                    <xs:element type="xs:string" name="loyalty" minOccurs="0"  maxOccurs="1" />
                                    <xs:element type="xs:boolean" name="upsidedown" minOccurs="0" maxOccurs="1" />
                                    <xs:element type="xs:boolean" name="token" minOccurs="0" maxOccurs="1" />
                                    <xs:choice minOccurs="0" maxOccurs="unbounded">
                                        <xs:element type="relatedType" name="related" />
                                        <xs:element type="relatedType" name="reverse-related" />
                                    </xs:choice>
                            </xs:sequence>
                        </xs:complexType>
                    </xs:element>
                </xs:sequence>
            </xs:complexType>
        </xs:element>
      </xs:all>
      <xs:attribute type="xs:integer" name="version"/>
    </xs:complexType>
  </xs:element>
</xs:schema>
