String defaultAtt = (String) attrValues[XSAttributeChecker.ATTIDX_DEFAULT];
String fixedAtt = (String) attrValues[XSAttributeChecker.ATTIDX_FIXED];
String nameAtt = (String) attrValues[XSAttributeChecker.ATTIDX_NAME];
QName refAtt = (QName) attrValues[XSAttributeChecker.ATTIDX_REF];
XInt useAtt = (XInt) attrValues[XSAttributeChecker.ATTIDX_USE];
// get 'attribute declaration'
XSAttributeDecl attribute = null;
if (refAtt != null) {
attribute = (XSAttributeDecl)fSchemaHandler.getGlobalDecl(schemaDoc, XSDHandler.ATTRIBUTE_TYPE, refAtt);
Element child = DOMUtil.getFirstChildElement(attrDecl);
if(child != null && DOMUtil.getLocalName(child).equals(SchemaSymbols.ELT_ANNOTATION)) {
traverseAnnotationDecl(child, attrValues, false, schemaDoc);
child = DOMUtil.getNextSiblingElement(child);
}
if (child != null) {
reportSchemaError("src-attribute.3.2", new Object[]{refAtt});
}
// for error reporting
nameAtt = refAtt.localpart;
} else {
attribute = traverseNamedAttr(attrDecl, attrValues, schemaDoc, grammar, false);
}
// get 'value constraint'
short consType = XSAttributeDecl.NO_CONSTRAINT;
if (defaultAtt != null) {
consType = XSAttributeDecl.DEFAULT_VALUE;
} else if (fixedAtt != null) {
consType = XSAttributeDecl.FIXED_VALUE;
defaultAtt = fixedAtt;
fixedAtt = null;
}
XSAttributeUse attrUse = null;
if (attribute != null) {
attrUse = new XSAttributeUse();
attrUse.fAttrDecl = attribute;
attrUse.fUse = useAtt.shortValue();
attrUse.fConstraintType = consType;
attrUse.fDefault = defaultAtt;
}
fAttrChecker.returnAttrArray(attrValues, schemaDoc);
//src-attribute
// 1 default and fixed must not both be present.
if (defaultAtt != null && fixedAtt != null) {
reportSchemaError("src-attribute.1", new Object[]{nameAtt});
}
// 2 If default and use are both present, use must have the �actual value� optional.
if (consType == XSAttributeDecl.DEFAULT_VALUE &&
useAtt != null && useAtt.intValue() != SchemaSymbols.USE_OPTIONAL) {
reportSchemaError("src-attribute.2", new Object[]{nameAtt});
}
// a-props-correct