Element traverseAttrsAndAttrGrps(Element firstAttr, XSAttributeGroupDecl attrGrp,
XSDocumentInfo schemaDoc, SchemaGrammar grammar ) {
Element child=null;
XSAttributeGroupDecl tempAttrGrp = null;
XSAttributeUse tempAttrUse = null;
String childName;
for (child=firstAttr; child!=null; child=DOMUtil.getNextSiblingElement(child)) {
childName = DOMUtil.getLocalName(child);
if (childName.equals(SchemaSymbols.ELT_ATTRIBUTE)) {
tempAttrUse = fSchemaHandler.fAttributeTraverser.traverseLocal(child,
schemaDoc, grammar);
if (tempAttrUse == null) break;
if (attrGrp.getAttributeUse(tempAttrUse.fAttrDecl.fTargetNamespace,
tempAttrUse.fAttrDecl.fName)==null) {
String idName = attrGrp.addAttributeUse(tempAttrUse);
if (idName != null) {
reportGenericSchemaError("Two distinct members of the {attribute uses} '" +
idName + "' and '" + tempAttrUse.fAttrDecl.fName +
"' have {attribute declaration}s both of whose {type definition}s are or are derived from ID");
}
}
else {
// REVISIT: what if one of the attribute uses is "prohibited"
reportGenericSchemaError("Duplicate attribute " +
tempAttrUse.fAttrDecl.fName + " found ");
}
}
else if (childName.equals(SchemaSymbols.ELT_ATTRIBUTEGROUP)) {
//REVISIT: do we need to save some state at this point??
tempAttrGrp = fSchemaHandler.fAttributeGroupTraverser.traverseLocal(
child, schemaDoc, grammar);
if(tempAttrGrp == null ) break;
XSAttributeUse[] attrUseS = tempAttrGrp.getAttributeUses();
XSAttributeUse existingAttrUse = null;
for (int i=0; i<attrUseS.length; i++) {
existingAttrUse = attrGrp.getAttributeUse(attrUseS[i].fAttrDecl.fTargetNamespace,
attrUseS[i].fAttrDecl.fName);
if (existingAttrUse == null) {
String idName = attrGrp.addAttributeUse(attrUseS[i]);