*/
private boolean processExtensions() {
// first clear all the cross reference information
for (Iterator iter = m_validationContext.iterateSchemas(); iter.hasNext();) {
SchemaElement schema = (SchemaElement)iter.next();
int count = schema.getChildCount();
for (int i = 0; i < count; i++) {
SchemaBase child = schema.getChild(i);
Object obj = child.getExtension();
if (obj instanceof GlobalExtension) {
((GlobalExtension)obj).resetDependencies();
}
}
}
// process each loaded schema for deletions and cross referencing
int index = 0;
m_validationContext.clearTraversed();
boolean modified = false;
// Level level = TreeWalker.setLogging(s_logger.getLevel());
for (Iterator iter = m_validationContext.iterateSchemas(); iter.hasNext();) {
SchemaElement schema = (SchemaElement)iter.next();
m_validationContext.enterSchema(schema);
s_logger.debug("Applying extensions to schema " + ++index + ": " + schema.getResolver().getName());
int count = schema.getChildCount();
boolean instmod = false;
for (int i = 0; i < count; i++) {
SchemaBase child = schema.getChild(i);
Object obj = child.getExtension();
if (obj instanceof GlobalExtension) {
// apply extension to global definition element
ComponentExtension exten = (ComponentExtension)obj;
if (exten.isRemoved()) {
// just eliminate this definition from the schema
schema.detachChild(i);
instmod = true;
} else {
// process the definition to remove references to deleted components
exten.applyAndCountUsage(m_validationContext);
}
}
}
if (instmod) {
schema.compactChildren();
modified = true;
}
m_validationContext.exitSchema();
}