xbean-blueprint/src/main/java/org/apache/xbean/blueprint/generator/XsdGenerator.java [175:208]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    private void generateElementMappingComplexProperty(PrintWriter out, NamespaceMapping namespaceMapping, AttributeMapping attributeMapping) {
        Type type = attributeMapping.getType();
        List types;
        if (type.isCollection()) {
            types = Utils.findImplementationsOf(namespaceMapping, type.getNestedType());
        } else {
            types = Utils.findImplementationsOf(namespaceMapping, type);
        }
        String maxOccurs = type.isCollection() || "java.util.Map".equals(type.getName()) ? "unbounded" : "1";

        out.println("        <xs:element name='" + attributeMapping.getAttributeName() + "' minOccurs='0' maxOccurs='" + maxOccurs + "'>");
        if (!isEmptyString(attributeMapping.getDescription())) {
            out.println("          <xs:annotation>");
            out.println("            <xs:documentation><![CDATA[");
            out.println("              " + attributeMapping.getDescription());
            out.println("            ]]></xs:documentation>");
            out.println("          </xs:annotation>");
        }
        out.println("          <xs:complexType>");
        if (types.isEmpty()) {
            // We don't know the type because it's generic collection.  Allow folks to insert objets from any namespace
            out.println("            <xs:sequence minOccurs='0' maxOccurs='" + maxOccurs + "'><xs:any minOccurs='0' maxOccurs='unbounded'/></xs:sequence>");
        } else {
            out.println("            <xs:choice minOccurs='0' maxOccurs='" + maxOccurs + "'>");
            for (Iterator iterator = types.iterator(); iterator.hasNext();) {
                ElementMapping element = (ElementMapping) iterator.next();
                out.println("              <xs:element ref='tns:" + element.getElementName() + "'/>");
            }
            out.println("              <xs:any namespace='##other'/>");
            out.println("            </xs:choice>");
        }
        out.println("          </xs:complexType>");
        out.println("        </xs:element>");
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



xbean-spring/src/main/java/org/apache/xbean/spring/generator/XsdGenerator.java [188:221]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    private void generateElementMappingComplexProperty(PrintWriter out, NamespaceMapping namespaceMapping, AttributeMapping attributeMapping) {
        Type type = attributeMapping.getType();
        List types;
        if (type.isCollection()) {
            types = Utils.findImplementationsOf(namespaceMapping, type.getNestedType());
        } else {
            types = Utils.findImplementationsOf(namespaceMapping, type);
        }
        String maxOccurs = type.isCollection() || "java.util.Map".equals(type.getName()) ? "unbounded" : "1";

        out.println("        <xs:element name='" + attributeMapping.getAttributeName() + "' minOccurs='0' maxOccurs='" + maxOccurs + "'>");
        if (!isEmptyString(attributeMapping.getDescription())) {
            out.println("          <xs:annotation>");
            out.println("            <xs:documentation><![CDATA[");
            out.println("              " + attributeMapping.getDescription());
            out.println("            ]]></xs:documentation>");
            out.println("          </xs:annotation>");
        }
        out.println("          <xs:complexType>");
        if (types.isEmpty()) {
            // We don't know the type because it's generic collection.  Allow folks to insert objets from any namespace
            out.println("            <xs:sequence minOccurs='0' maxOccurs='" + maxOccurs + "'><xs:any minOccurs='0' maxOccurs='unbounded'/></xs:sequence>");
        } else {
            out.println("            <xs:choice minOccurs='0' maxOccurs='" + maxOccurs + "'>");
            for (Iterator iterator = types.iterator(); iterator.hasNext();) {
                ElementMapping element = (ElementMapping) iterator.next();
                out.println("              <xs:element ref='tns:" + element.getElementName() + "'/>");
            }
            out.println("              <xs:any namespace='##other'/>");
            out.println("            </xs:choice>");
        }
        out.println("          </xs:complexType>");
        out.println("        </xs:element>");
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



