in src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java [2071:2113]
Element serializeSimpleTypeRestriction(Document doc, XmlSchemaSimpleTypeRestriction restrictionObj,
XmlSchema schema) throws XmlSchemaSerializerException {
// todo: need to implement any attribute that related to non schema namespace
Element serializedRestriction = createNewElement(doc, "restriction",
schema.getSchemaNamespacePrefix(),
XmlSchema.SCHEMA_NS);
if (schema.getSchemaNamespacePrefix().length() > 0) {
serializedRestriction.setPrefix(schema.getSchemaNamespacePrefix());
}
if (restrictionObj.getBaseTypeName() != null) {
String baseType = resolveQName(restrictionObj.getBaseTypeName(), schema);
serializedRestriction.setAttribute("base", baseType);
} else if (restrictionObj.getBaseType() instanceof XmlSchemaSimpleType) {
Element inlineSimpleType = serializeSimpleType(doc, restrictionObj.getBaseType(), schema);
serializedRestriction.appendChild(inlineSimpleType);
} else {
throw new XmlSchemaSerializerException("restriction must be define "
+ "with specifying base or inline simpleType");
}
if (restrictionObj.getId() != null) {
serializedRestriction.setAttribute("id", restrictionObj.getId());
}
if (restrictionObj.getAnnotation() != null) {
Element annotation = serializeAnnotation(doc, restrictionObj.getAnnotation(), schema);
serializedRestriction.appendChild(annotation);
}
if (restrictionObj.getFacets().size() > 0) {
int facetsNum = restrictionObj.getFacets().size();
for (int i = 0; i < facetsNum; i++) {
Element facetEl = serializeFacet(doc, (XmlSchemaFacet)restrictionObj.getFacets().get(i),
schema);
serializedRestriction.appendChild(facetEl);
}
}
// process extension
processExtensibilityComponents(restrictionObj, serializedRestriction);
return serializedRestriction;
}