<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:nest="http://www.mulesource.org/schema/mule/nest-example-base/2.0"
       xmlns:ext="http://www.mulesource.org/schema/mule/nest-example-extension/2.0"
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
       http://www.mulesource.org/schema/mule/nest-example-base/2.0 http://www.mulesource.org/schema/mule/nest-example-base/2.0/nest-example-base.xsd
       http://www.mulesource.org/schema/mule/nest-example-extension/2.0 http://www.mulesource.org/schema/mule/nest-example-extension/2.0/nest-example-extension.xsd">

    <!-- root container must be used -->
    <!-- nest:simple/ -->

    <!-- simple nesting -->
    <nest:root>
        <nest:simple>
            <nest:simple simpleAttr="foo">
                <nest:simple/>
            </nest:simple>
            <nest:simple/>
        </nest:simple>
    </nest:root>

    <!-- abstract won't validate -->
    <nest:root>
        <nest:simple>
            <!-- nest:abstract/ -->
        </nest:simple>
    </nest:root>

    <!-- this validates and allows nesting -->
    <nest:root>
        <nest:simple>
            <ext:subclass>
                <nest:simple>
                    <ext:subclass/>
                </nest:simple>
            </ext:subclass>
        </nest:simple>
    </nest:root>

    <!-- you can extend the subclass with elements and attributes -->
    <!-- disclaimer: i didn't think attributes could be added! -->
    <nest:root>
        <nest:simple>
            <ext:subclass simpleAttr="bar" another="baz">
                <ext:random/>
            </ext:subclass>
        </nest:simple>
    </nest:root>

    <!-- unfortunately, this validates because abstract and subclass are defined at
         the "top level" of their schema.  i don't know how to avoid this -->
    <ext:subclass/>
    <!-- this won't work though, because it's abstract -->
    <!-- nest:abstract/ -->

    <!-- we can also use xsi:type explicitly, but are forced to use the same
         element name.  since definition parsers are associated with names this
         is only practical for containers. -->
    <nest:root>
        <nest:simple>
            <nest:simple xsi:type="ext:typedSubclassType" more="foo">
                <nest:simple/>
                <ext:another/>
            </nest:simple>
        </nest:simple>
    </nest:root>

</beans>
