/** Add new top-level type definitions. **/
map = newGrammar.getComponents(XSConstants.TYPE_DEFINITION);
length = map.getLength();
for (int i = 0; i < length; ++i) {
XSTypeDefinition decl = (XSTypeDefinition) map.item(i);
if (cachedGrammar.getGlobalTypeDecl(decl.getName()) == null) {
cachedGrammar.addGlobalTypeDecl(decl);
}
}
/** Add new top-level attribute group definitions. **/
map = newGrammar.getComponents(XSConstants.ATTRIBUTE_GROUP);
length = map.getLength();
for (int i = 0; i < length; ++i) {
XSAttributeGroupDecl decl = (XSAttributeGroupDecl) map.item(i);
if (cachedGrammar.getGlobalAttributeGroupDecl(decl.getName()) == null) {
cachedGrammar.addGlobalAttributeGroupDecl(decl);
}
}
/** Add new top-level model group definitions. **/
map = newGrammar.getComponents(XSConstants.MODEL_GROUP);
length = map.getLength();
for (int i = 0; i < length; ++i) {
XSGroupDecl decl = (XSGroupDecl) map.item(i);
if (cachedGrammar.getGlobalGroupDecl(decl.getName()) == null) {
cachedGrammar.addGlobalGroupDecl(decl);
}
}
/** Add new top-level notation declarations. **/
map = newGrammar.getComponents(XSConstants.NOTATION_DECLARATION);
length = map.getLength();
for (int i = 0; i < length; ++i) {
XSNotationDecl decl = (XSNotationDecl) map.item(i);
if (cachedGrammar.getGlobalNotationDecl(decl.getName()) == null) {
cachedGrammar.addGlobalNotationDecl(decl);
}
}
/**