result.validate();
annotations = new XSAnnotation[]{result};
}
if (isSimple()) {
XSSimpleType mySimpleType;
Object baseObject = getXsObject();
if (baseObject instanceof XsTSimpleType) {
XsTSimpleType myXsTSimpleType = (XsTSimpleType) baseObject;
XsEList list = myXsTSimpleType.getList();
if (list == null) {
XsEUnion union = myXsTSimpleType.getUnion();
if (union == null) {
XsERestriction restriction = myXsTSimpleType.getRestriction();
if (restriction == null) {
throw new LocSAXException("Either of the 'list', 'union', or 'restriction' child elements must be set.",
myXsTSimpleType.getLocator());
}
XsQName myName = restriction.getBase();
XSType restrictedType;
if (myName == null) {
XsTLocalSimpleType baseType = restriction.getSimpleType();
if (baseType == null) {
throw new LocSAXException("Neither the 'base' attribute nor an inner 'simpleType' element are present",
restriction.getLocator());
} else {
restrictedType = getXSSchema().getXSObjectFactory().newXSType(this, baseType);
}
} else {
restrictedType = getXSSchema().getType(myName);
if (restrictedType == null) {
throw new LocSAXException("Unknown base type: " + myName,
restriction.getLocator());
}
}
restrictedType.validate();
if (!restrictedType.isSimple()) {
throw new LocSAXException("The restricted type " + myName + " is complex.",
restriction.getLocator());
}
XSSimpleType baseType = restrictedType.getSimpleType();
if (baseType.isAtomic()) {
mySimpleType = getXSSchema().getXSObjectFactory().newXSAtomicType(this, restrictedType, restriction);
} else if (baseType.isList()) {
mySimpleType = getXSSchema().getXSObjectFactory().newXSListType(this, restrictedType, restriction);
} else if (baseType.isUnion()) {
mySimpleType = getXSSchema().getXSObjectFactory().newXSUnionType(this, restrictedType, restriction);
} else {
throw new LocSAXException("Unknown restriction type: " + baseType, restriction.getLocator());
}
} else {