in xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java [726:779]
Element serializeComplexContentExtension(Document doc, XmlSchemaComplexContentExtension extensionObj,
XmlSchema schema) throws XmlSchemaSerializerException {
Element extension = createNewElement(doc, "extension", schema.getSchemaNamespacePrefix(),
XmlSchema.SCHEMA_NS);
if (extensionObj.getBaseTypeName() != null) {
String baseType = resolveQName(extensionObj.getBaseTypeName(), schema);
extension.setAttributeNS(null, "base", baseType);
}
if (extensionObj.getAnnotation() != null) {
Element annotation = serializeAnnotation(doc, extensionObj.getAnnotation(), schema);
extension.appendChild(annotation);
}
if (extensionObj.getParticle() instanceof XmlSchemaSequence) {
Element sequenceParticle = serializeSequence(doc, (XmlSchemaSequence)extensionObj.getParticle(),
schema);
extension.appendChild(sequenceParticle);
} else if (extensionObj.getParticle() instanceof XmlSchemaChoice) {
Element choiceParticle = serializeChoice(doc,
(XmlSchemaChoice)extensionObj.getParticle(), schema);
extension.appendChild(choiceParticle);
} else if (extensionObj.getParticle() instanceof XmlSchemaAll) {
Element allParticle = serializeAll(doc, (XmlSchemaAll)extensionObj.getParticle(), schema);
extension.appendChild(allParticle);
} else if (extensionObj.getParticle() instanceof XmlSchemaGroupRef) {
Element groupRefParticle = serializeGroupRef(doc, (XmlSchemaGroupRef)extensionObj.getParticle(),
schema);
extension.appendChild(groupRefParticle);
}
int attributesLength = extensionObj.getAttributes().size();
for (int i = 0; i < attributesLength; i++) {
XmlSchemaObject obj = extensionObj.getAttributes().get(i);
if (obj instanceof XmlSchemaAttribute) {
Element attr = serializeAttribute(doc, (XmlSchemaAttribute)obj, schema);
extension.appendChild(attr);
} else if (obj instanceof XmlSchemaAttributeGroupRef) {
Element attrGroup = serializeAttributeGroupRef(doc, (XmlSchemaAttributeGroupRef)obj, schema);
extension.appendChild(attrGroup);
}
}
if (extensionObj.getAnyAttribute() != null) {
Element anyAttribute = serializeAnyAttribute(doc, extensionObj.getAnyAttribute(), schema);
extension.appendChild(anyAttribute);
}
// process extension
processExtensibilityComponents(extensionObj, extension);
return extension;
}