in xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java [1903:1955]
Element serializeSimpleContentRestriction(Document doc, XmlSchemaSimpleContentRestriction restrictionObj,
XmlSchema schema) throws XmlSchemaSerializerException {
Element restriction = createNewElement(doc, "restriction", schema.getSchemaNamespacePrefix(),
XmlSchema.SCHEMA_NS);
if (restrictionObj.getBaseTypeName() != null) {
String baseTypeName = resolveQName(restrictionObj.getBaseTypeName(), schema);
restriction.setAttributeNS(null, "base", baseTypeName);
}
if (restrictionObj.getId() != null) {
restriction.setAttributeNS(null, "id", restrictionObj.getId());
}
if (restrictionObj.getAnnotation() != null) {
Element annotation = serializeAnnotation(doc, restrictionObj.getAnnotation(), schema);
restriction.appendChild(annotation);
}
if (restrictionObj.getBaseType() != null) {
Element inlineSimpleType = serializeSimpleType(doc, restrictionObj.getBaseType(), schema);
restriction.appendChild(inlineSimpleType);
}
List<XmlSchemaFacet> facets = restrictionObj.getFacets();
int facetLength = facets.size();
for (int i = 0; i < facetLength; i++) {
Element facet = serializeFacet(doc, facets.get(i), schema);
restriction.appendChild(facet);
}
int attrCollLength = restrictionObj.getAttributes().size();
for (int i = 0; i < attrCollLength; i++) {
XmlSchemaAnnotated obj = restrictionObj.getAttributes().get(i);
if (obj instanceof XmlSchemaAttribute) {
Element attribute = serializeAttribute(doc, (XmlSchemaAttribute)obj, schema);
restriction.appendChild(attribute);
} else if (obj instanceof XmlSchemaAttributeGroupRef) {
Element attributeGroup = serializeAttributeGroupRef(doc, (XmlSchemaAttributeGroupRef)obj,
schema);
restriction.appendChild(attributeGroup);
}
}
if (restrictionObj.anyAttribute != null) {
Element anyAttribute = serializeAnyAttribute(doc, restrictionObj.anyAttribute, schema);
restriction.appendChild(anyAttribute);
}
// process extension
processExtensibilityComponents(restrictionObj, restriction);
return restriction;
}