in src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java [1828:1876]
Element serializeSimpleContentExtension(Document doc, XmlSchemaSimpleContentExtension extensionObj,
XmlSchema schema) throws XmlSchemaSerializerException {
Element extension = createNewElement(doc, "extension", schema.getSchemaNamespacePrefix(),
XmlSchema.SCHEMA_NS);
if (extensionObj.getBaseTypeName() != null) {
String baseTypeName = resolveQName(extensionObj.getBaseTypeName(), schema);
extension.setAttribute("base", baseTypeName);
}
if (extensionObj.getId() != null) {
extension.setAttribute("id", extensionObj.getId());
}
if (extensionObj.getAnnotation() != null) {
Element annotation = serializeAnnotation(doc, extensionObj.getAnnotation(), schema);
extension.appendChild(annotation);
}
List<XmlSchemaAttributeOrGroupRef> attributes = extensionObj.getAttributes();
int attributeLength = attributes.size();
for (int i = 0; i < attributeLength; i++) {
XmlSchemaObject obj = attributes.get(i);
if (obj instanceof XmlSchemaAttribute) {
Element attribute = serializeAttribute(doc, (XmlSchemaAttribute)obj, schema);
extension.appendChild(attribute);
} else if (obj instanceof XmlSchemaAttributeGroupRef) {
Element attributeGroupRef = serializeAttributeGroupRef(doc, (XmlSchemaAttributeGroupRef)obj,
schema);
extension.appendChild(attributeGroupRef);
}
}
/*
* anyAttribute must comeafter any other attributes
*/
if (extensionObj.getAnyAttribute() != null) {
Element anyAttribute = serializeAnyAttribute(doc, extensionObj.getAnyAttribute(), schema);
extension.appendChild(anyAttribute);
}
// process extension
processExtensibilityComponents(extensionObj, extension);
return extension;
}