<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    elementFormDefault="qualified"
    targetNamespace="http://www.javarants.com/schemas/javabeans-1.0.xsd"
    xmlns="http://www.javarants.com/schemas/javabeans-1.0.xsd">
    <xs:element name="java">
        <xs:complexType>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:element ref="object"/>
                <xs:element ref="void"/>
                <xs:element ref="string"/>
                <xs:element ref="class"/>
                <xs:element ref="null"/>
                <xs:element ref="array"/>
                <xs:element ref="boolean"/>
                <xs:element ref="byte"/>
                <xs:element ref="char"/>
                <xs:element ref="short"/>
                <xs:element ref="int"/>
                <xs:element ref="long"/>
                <xs:element ref="float"/>
                <xs:element ref="double"/>
            </xs:choice>
            <xs:attribute name="version">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:pattern value="[\d._]+"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
            <xs:attribute name="class" type="classType"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="boolean" type="xs:boolean"/>
    <xs:element name="byte" type="xs:byte"/>
    <xs:element name="char">
        <xs:simpleType>
            <xs:restriction base="xs:string">
                <xs:length value="1"/>
            </xs:restriction>
        </xs:simpleType>
    </xs:element>
    <xs:element name="short" type="xs:short"/>
    <xs:element name="int" type="xs:int"/>
    <xs:element name="long" type="xs:long"/>
    <xs:element name="float" type="xs:float"/>
    <xs:element name="double" type="xs:double"/>
    <xs:element name="string" type="xs:string"/>
    <xs:element name="class" type="classType"/>
    <xs:element name="null" type="xs:string"/>
    <xs:element name="object">
        <xs:complexType>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:element ref="object"/>
                <xs:element ref="void"/>
                <xs:element ref="string"/>
                <xs:element ref="class"/>
                <xs:element ref="null"/>
                <xs:element ref="array"/>
                <xs:element ref="boolean"/>
                <xs:element ref="byte"/>
                <xs:element ref="char"/>
                <xs:element ref="short"/>
                <xs:element ref="int"/>
                <xs:element ref="long"/>
                <xs:element ref="float"/>
                <xs:element ref="double"/>
            </xs:choice>
            <xs:attribute name="id" type="xs:ID"/>
            <xs:attribute name="idref" type="xs:IDREF"/>
            <xs:attribute name="class" type="classType"/>
            <xs:attribute name="field" type="memberType"/>
            <xs:attribute name="method" type="memberType"/>
            <xs:attribute name="property" type="memberType"/>
            <xs:attribute name="index" type="xs:int"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="array">
        <xs:complexType>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:element ref="object"/>
                <xs:element ref="void"/>
                <xs:element ref="string"/>
                <xs:element ref="class"/>
                <xs:element ref="null"/>
                <xs:element ref="array"/>
                <xs:element ref="boolean"/>
                <xs:element ref="byte"/>
                <xs:element ref="char"/>
                <xs:element ref="short"/>
                <xs:element ref="int"/>
                <xs:element ref="long"/>
                <xs:element ref="float"/>
                <xs:element ref="double"/>
            </xs:choice>
            <xs:attribute name="id" type="xs:ID"/>
            <xs:attribute name="class" type="classType" />
            <xs:attribute name="length" type="xs:int"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="void">
        <xs:complexType>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:element ref="object"/>
                <xs:element ref="void"/>
                <xs:element ref="string"/>
                <xs:element ref="class"/>
                <xs:element ref="null"/>
                <xs:element ref="array"/>
                <xs:element ref="boolean"/>
                <xs:element ref="byte"/>
                <xs:element ref="char"/>
                <xs:element ref="short"/>
                <xs:element ref="int"/>
                <xs:element ref="long"/>
                <xs:element ref="float"/>
                <xs:element ref="double"/>
            </xs:choice>
            <xs:attribute name="id" type="xs:ID"/>
            <xs:attribute name="class" type="classType"/>
            <xs:attribute name="method" type="memberType"/>
            <xs:attribute name="property" type="memberType"/>
            <xs:attribute name="index" type="xs:int"/>
        </xs:complexType>
    </xs:element>
    <xs:simpleType name="classType">
        <xs:restriction base="xs:string">
            <xs:pattern value="[a-zA-Z_][a-zA-Z\d._]*"/>
        </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="memberType">
        <xs:restriction base="xs:string">
            <xs:pattern value="[a-zA-Z_][a-zA-Z\d_]*"/>
        </xs:restriction>
    </xs:simpleType>
</xs:schema>
