XSObjectListImpl attrAssertList = new XSObjectListImpl();
for (int attrIndx = 0; attrIndx < attributes.getLength(); attrIndx++) {
Augmentations attrAugs = attributes.getAugmentations(attrIndx);
AttributePSVImpl attrPSVI = (AttributePSVImpl) attrAugs.getItem(Constants.ATTRIBUTE_PSVI);
XSSimpleTypeDefinition attrType = (XSSimpleTypeDefinition) attrPSVI.getTypeDefinition();
if (attrType != null) {
// this accumulates assertions only for "simpleType -> restriction"
XSObjectList facets = attrType.getMultiValueFacets();
// simpleType variety is 'unknown/absent' at the moment
short attrTypeVariety = XSSimpleTypeDefinition.VARIETY_ABSENT;
if (facets.getLength() == 0 && attrType.getItemType() != null) {
// facets for "simpleType -> list"
attrTypeVariety = XSSimpleTypeDefinition.VARIETY_LIST;
facets = (XSObjectListImpl) attrType.getItemType().getMultiValueFacets();
}
else if (attrType.getVariety() == XSSimpleTypeDefinition.VARIETY_UNION) {
attrTypeVariety = XSSimpleTypeDefinition.VARIETY_UNION;
// Special handling for assertions on "simpleType -> union" cases. Adding an assertion here,
// for determining the XSModel NamespaceContext. This particular assertion object is not
// actually evaluated. For simpleType's with variety union, assertions are later again determined
// in XMLAssertPsychopathImpl, which are evaluated to determine validity of an XML instance.
XSAssertImpl assertImpl = getFirstAssertFromUnionMemberTypes(attrType.getMemberTypes());
if (assertImpl != null) {
assertImpl.setTypeDefinition(attrType);
assertImpl.setVariety(attrTypeVariety);
assertImpl.setAttrName(attributes.getLocalName(attrIndx));
assertImpl.setAttrValue(attributes.getValue(attrIndx));