<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
    <xs:complexType name="AddressType">
        <xs:sequence>
            <xs:element name="Forename" type="xs:string"/>
            <xs:element name="Surname" type="xs:string"/>
            <xs:element name="AddresLine1" type="xs:string"/>
            <xs:element name="AddresLine2" type="xs:string"/>
            <xs:element name="AddresLine3" type="xs:string" minOccurs="0"/>
            <xs:element name="AddresLine4" type="xs:string" minOccurs="0"/>
            <xs:element name="AddresLine5" type="xs:string"/>
            <xs:element name="PostCode" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="ItemType">
        <xs:sequence>
            <xs:element name="StockCode" type="xs:unsignedLong"/>
            <xs:element name="Description" type="xs:string"/>
            <xs:element name="UnitCost" type="xs:long"/>
            <xs:element name="Quantity" type="xs:unsignedInt"/>
        </xs:sequence>
    </xs:complexType>
    <xs:element name="Invoice">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="InvoiceNo" type="xs:unsignedInt"/>
                <xs:element name="DeliveryAddress" type="AddressType"/>
                <xs:element name="BillingAddress" type="AddressType" minOccurs="0"/>
                <xs:element name="Item" type="ItemType" maxOccurs="unbounded"/>
                <xs:element name="Payment">
                    <xs:complexType>
                        <xs:choice>
                            <xs:element name="VISA">
                                <xs:complexType>
                                    <xs:attribute name="CardNo" type="xs:string" use="required"/>
                                    <xs:attribute name="Expiry" type="xs:gYearMonth" use="required"/>
                                </xs:complexType>
                            </xs:element>
                            <xs:element name="Vouchers" maxOccurs="unbounded">
                                <xs:complexType>
                                    <xs:attribute name="VoucherNo" type="xs:unsignedLong" use="required"/>
                                    <xs:attribute name="VoucherValue" type="xs:unsignedLong" use="required"/>
                                </xs:complexType>
                            </xs:element>
                            <xs:element name="Cash"/>
                        </xs:choice>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>