if( defaultedAttributes.size()==0 )
return; // no default attribute is used. no need for the check.
Iterator itr = defaultedAttributes.entrySet().iterator();
ResidualCalculator resCalc = new ResidualCalculator(reader.pool);
while( itr.hasNext() ) {
Map.Entry item = (Map.Entry)itr.next();
AttributeExp exp = (AttributeExp)item.getKey();
String value = (String)item.getValue();
// tests if the name class is simple
if(!(exp.nameClass instanceof SimpleNameClass))
reportCompError(
new Locator[]{reader.getDeclaredLocationOf(exp)},
CERR_DEFVALUE_NAME_IS_NOT_SIMPLE);
// tests if there is no context-dependent datatypes
try {
exp.exp.visit( contextDependentTypeChecker );
} catch( Abort a ) {
continue; // abort further check. this error is already reported.
}
// tests if the default value matches the content model of this attribute
StringToken token = new StringToken(resCalc,value,null,null);
if(!resCalc.calcResidual( exp.exp, token ).isEpsilonReducible() ) {
// the default value was rejected by the content model.
reportCompError(
new Locator[]{reader.getDeclaredLocationOf(exp)},
CERR_DEFVALUE_INVALID, new Object[]{value});
}