// mark schema namespace as defined
markSchemaAsDefined(xsdSchema);
// TODO: undefined grammar check.
Expression grammarTopLevel = Expression.nullSet;
itr = grammar.iterateSchemas();
while( itr.hasNext() ) {
XMLSchemaSchema schema = (XMLSchemaSchema)itr.next();
if( !isSchemaDefined(schema) ) {
reportError(
backwardReference.getReferer(schema),
ERR_UNDEFINED_SCHEMA,
new Object[]{schema.targetNamespace} );
return; // surpress excessive error messages.
}
// detect undefined declarations.
detectUndefinedOnes( schema.attributeDecls, ERR_UNDEFINED_ATTRIBUTE_DECL );
detectUndefinedOnes( schema.attributeGroups, ERR_UNDEFINED_ATTRIBUTE_GROUP );
detectUndefinedOnes( schema.complexTypes, ERR_UNDEFINED_COMPLEX_TYPE );
detectUndefinedOnes( schema.elementDecls, ERR_UNDEFINED_ELEMENT_DECL );
detectUndefinedOnes( schema.groupDecls, ERR_UNDEFINED_GROUP );
detectUndefinedOnes( schema.simpleTypes, ERR_UNDEFINED_SIMPLE_TYPE );
// TODO: it is now possible to check that the derivation doesn't
// violate the final property of the parent type.
// prepare top-level expression.
// at the same time, compute the substitutions field of ElementDeclExps.
// TODO: make sure this is a correct implementation
// any globally declared element can be a top-level element.
Expression exp = Expression.nullSet;
ReferenceExp[] elems = schema.elementDecls.getAll();
for( int i=0; i<elems.length; i++ )
exp = pool.createChoice( exp, elems[i] );
schema.topLevel = exp;