<?xml version='1.0'?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns="http://www.castor.org/MasterTestSuite/xml/SourceGenerator/NestedGroup"
            targetNamespace="http://www.castor.org/MasterTestSuite/xml/SourceGenerator/NestedGroup">

    <xsd:element name="Report">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="Invoice" maxOccurs="unbounded">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:choice  minOccurs="1" maxOccurs="unbounded">
                                <xsd:element name="Toy" type="xsd:string"/>
                                    <xsd:sequence>
                                        <xsd:element name="DVD" type="xsd:string"/>
                                        <xsd:element name="Title" type="xsd:string"/>
                                    </xsd:sequence>
                                <xsd:element name="Other" type="xsd:string"/>
                            </xsd:choice>
                            <xsd:group ref="shipAndBill" minOccurs='0' maxOccurs='unbounded'/>
                        </xsd:sequence>
                        <xsd:attribute name="Id" type="xsd:int"/>
                    </xsd:complexType>
                </xsd:element>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>

    <xsd:group name="shipAndBill">
        <xsd:sequence>
            <xsd:element name="shipTo" type="AddressType" minOccurs='0'/>
                <xsd:choice>
                    <xsd:element name="CreditCard" type="xsd:boolean"/>
                    <xsd:element name="Check" type="xsd:boolean"/>
                </xsd:choice>
            <xsd:element name="billTo" type="AddressType" minOccurs='0'/>
        </xsd:sequence>
    </xsd:group>

    <xsd:complexType name="AddressType">
        <xsd:all>
            <xsd:element name="Name" type="xsd:string"/>
            <xsd:element name="Street" type="xsd:string"/>
            <xsd:element name="ZipCode" type="xsd:string"/>
        </xsd:all>
    </xsd:complexType>

</xsd:schema>
