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 {
mySimpleType = getXSSchema().getXSObjectFactory().newXSUnionType(this, union);
}
} else {
mySimpleType = getXSSchema().getXSObjectFactory().newXSListType(this, list);
}
}
else {
mySimpleType = getSimpleType();
}
this.simpleType = mySimpleType;
} else {
XSComplexTypeImpl myComplexType;
XsTComplexType myXsTComplexType = (XsTComplexType) getXsObject();
XsESimpleContent simpleContent = myXsTComplexType.getSimpleContent();
if (simpleContent == null) {
XsEComplexContent complexContent = myXsTComplexType.getComplexContent();
if (complexContent == null) {
XsTTypeDefParticle particle = myXsTComplexType.getTypeDefParticle();
if (particle == null) {
myComplexType = new XSSequenceComplexTypeImpl(this, myXsTComplexType);
} else if (particle instanceof XsESequence) {
myComplexType = new XSSequenceComplexTypeImpl(this, myXsTComplexType, (XsESequence) particle);
} else if (particle instanceof XsEChoice) {
myComplexType = new XSChoiceComplexTypeImpl(this, myXsTComplexType, (XsEChoice) particle);
} else if (particle instanceof XsTAll) {
myComplexType = new XSAllComplexTypeImpl(this, myXsTComplexType, (XsTAll) particle);
} else if (particle instanceof XsTGroupRef) {
XsTGroupRef groupRef = (XsTGroupRef) particle;
XsQName myName = groupRef.getRef();
if (myName == null) {
throw new LocSAXException("Missing 'ref' attribute", groupRef.getLocator());
}
XSGroup group = getXSSchema().getGroup(myName);
if (group == null) {
throw new LocSAXException("Unknown group: " + myName, getLocator());
}
group.validate();
myComplexType = new XSGroupComplexTypeImpl(this, myXsTComplexType, group);
} else {
throw new IllegalStateException("Invalid particle: " + particle.getClass().getName());