in xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java [870:956]
Element serializeComplexType(Document doc, XmlSchemaComplexType complexTypeObj, XmlSchema schema)
throws XmlSchemaSerializerException {
Element serializedComplexType = createNewElement(doc, "complexType",
schema.getSchemaNamespacePrefix(),
XmlSchema.SCHEMA_NS);
if (!complexTypeObj.isAnonymous()) {
serializedComplexType.setAttributeNS(null, "name", complexTypeObj.getName());
/*
* if(complexTypeObj.annotation != null){ Element annotationEl = serializeAnnotation(doc,
* complexTypeObj.annotation, schema); serializedComplexType.appendChild(annotationEl); }
*/
}
if (complexTypeObj.isMixed()) {
serializedComplexType.setAttributeNS(null, "mixed", "true");
}
if (complexTypeObj.isAbstract()) {
serializedComplexType.setAttributeNS(null, "abstract", "true");
}
if (complexTypeObj.getId() != null) {
serializedComplexType.setAttributeNS(null, "id", complexTypeObj.getId());
}
if (complexTypeObj.getAnnotation() != null) {
Element annotationEl = serializeAnnotation(doc, complexTypeObj.getAnnotation(), schema);
serializedComplexType.appendChild(annotationEl);
}
if (complexTypeObj.getContentModel() instanceof XmlSchemaSimpleContent) {
Element simpleContent = serializeSimpleContent(
doc,
(XmlSchemaSimpleContent)
complexTypeObj.getContentModel(),
schema);
serializedComplexType.appendChild(simpleContent);
} else if (complexTypeObj.getContentModel() instanceof XmlSchemaComplexContent) {
Element complexContent = serializeComplexContent(
doc,
(XmlSchemaComplexContent)
complexTypeObj.getContentModel(),
schema);
serializedComplexType.appendChild(complexContent);
}
if (complexTypeObj.getParticle() instanceof XmlSchemaSequence) {
Element sequence = serializeSequence(doc,
(XmlSchemaSequence)complexTypeObj.getParticle(), schema);
serializedComplexType.appendChild(sequence);
} else if (complexTypeObj.getParticle() instanceof XmlSchemaChoice) {
Element choice = serializeChoice(doc, (XmlSchemaChoice)complexTypeObj.getParticle(), schema);
serializedComplexType.appendChild(choice);
} else if (complexTypeObj.getParticle() instanceof XmlSchemaAll) {
Element all = serializeAll(doc, (XmlSchemaAll)complexTypeObj.getParticle(), schema);
serializedComplexType.appendChild(all);
} else if (complexTypeObj.getParticle() instanceof XmlSchemaGroupRef) {
Element group = serializeGroupRef(doc, (XmlSchemaGroupRef)complexTypeObj.getParticle(), schema);
serializedComplexType.appendChild(group);
}
if (complexTypeObj.getBlock() != null
&& complexTypeObj.getBlock() != XmlSchemaDerivationMethod.NONE) {
serializedComplexType.setAttributeNS(null, "block", complexTypeObj.toString());
}
if (complexTypeObj.getFinalDerivation() != null
&& complexTypeObj.getFinalDerivation() != XmlSchemaDerivationMethod.NONE) {
serializedComplexType.setAttributeNS(null, "final", complexTypeObj.getFinalDerivation().toString());
}
List<XmlSchemaAttributeOrGroupRef> attrColl = complexTypeObj.getAttributes();
if (attrColl.size() > 0) {
setupAttr(doc, attrColl, schema, serializedComplexType);
}
XmlSchemaAnyAttribute anyAttribute = complexTypeObj.getAnyAttribute();
if (anyAttribute != null) {
serializedComplexType.appendChild(serializeAnyAttribute(doc, anyAttribute, schema));
}
// process extension
processExtensibilityComponents(complexTypeObj, serializedComplexType);
return serializedComplexType;
}