QName baseTypeStr, short baseRefContext,
XSDocumentInfo schemaDoc) {
if (baseTypeStr == null)
return null;
XSTypeDefinition baseType = (XSTypeDefinition)fSchemaHandler.getGlobalDecl(schemaDoc, XSDHandler.TYPEDECL_TYPE, baseTypeStr, elm);
if (baseType == null) {
return null;
}
if (baseType.getTypeCategory() != XSTypeDefinition.SIMPLE_TYPE) {
reportSchemaError("cos-st-restricts.1.1", new Object[]{baseTypeStr.rawname, refName}, elm);
return null;
}
// if it's a complex type, or if its restriction of anySimpleType
if (baseType == SchemaGrammar.fAnySimpleType &&
baseRefContext == XSConstants.DERIVATION_RESTRICTION) {
// if the base type is anySimpleType and the current type is
// a S4S built-in type, return null. (not an error).
if (checkBuiltIn(refName, schemaDoc.fTargetNamespace)) {
return null;
}
reportSchemaError("cos-st-restricts.1.1", new Object[]{baseTypeStr.rawname, refName}, elm);
return null;
}
if ((baseType.getFinal() & baseRefContext) != 0) {
if (baseRefContext == XSConstants.DERIVATION_RESTRICTION) {
reportSchemaError("st-props-correct.3", new Object[]{refName, baseTypeStr.rawname}, elm);
}
else if (baseRefContext == XSConstants.DERIVATION_LIST) {
reportSchemaError("cos-st-restricts.2.3.1.1", new Object[]{baseTypeStr.rawname, refName}, elm);