Element serializeComplexContent()

in src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java [663:705]


    Element serializeComplexContent(Document doc, XmlSchemaComplexContent complexContentObj, XmlSchema schema)
        throws XmlSchemaSerializerException {

        Element complexContent = createNewElement(doc, "complexContent", schema.getSchemaNamespacePrefix(),
                                                  XmlSchema.SCHEMA_NS);

        if (complexContentObj.getAnnotation() != null) {
            Element annotation = serializeAnnotation(doc, complexContentObj.getAnnotation(), schema);
            complexContent.appendChild(annotation);
        }

        if (complexContentObj.isMixed()) {
            complexContent.setAttribute("mixed", "true");
        }
        if (complexContentObj.getId() != null) {
            complexContent.setAttribute("id", complexContentObj.getId());
        }

        Element content;
        if (complexContentObj.content instanceof XmlSchemaComplexContentRestriction) {
            content = serializeComplexContentRestriction(
                                                         doc,
                                                         (XmlSchemaComplexContentRestriction)
                                                         complexContentObj.content,
                                                         schema);
        } else if (complexContentObj.content instanceof XmlSchemaComplexContentExtension) {
            content = serializeComplexContentExtension(
                                                       doc,
                                                       (XmlSchemaComplexContentExtension)
                                                       complexContentObj.content,
                                                       schema);
        } else {
            throw new XmlSchemaSerializerException("content of complexContent "
                                                   + "must be restriction or extension");
        }

        complexContent.appendChild(content);

        // process extension
        processExtensibilityComponents(complexContentObj, complexContent);

        return complexContent;
    }