// General Attribute Checking
Object[] attrValues = fAttrChecker.checkAttributes(elmDecl, false, schemaDoc);
QName refAtt = (QName) attrValues[XSAttributeChecker.ATTIDX_REF];
XInt minAtt = (XInt) attrValues[XSAttributeChecker.ATTIDX_MINOCCURS];
XInt maxAtt = (XInt) attrValues[XSAttributeChecker.ATTIDX_MAXOCCURS];
XSElementDecl element = null;
if (elmDecl.getAttributeNode(SchemaSymbols.ATT_REF) != null) {
if (refAtt != null) {
element = (XSElementDecl)fSchemaHandler.getGlobalDecl(schemaDoc, XSDHandler.ELEMENT_TYPE, refAtt, elmDecl);
Element child = DOMUtil.getFirstChildElement(elmDecl);
if (child != null && DOMUtil.getLocalName(child).equals(SchemaSymbols.ELT_ANNOTATION)) {
// REVISIT: put this somewhere
traverseAnnotationDecl(child, attrValues, false, schemaDoc);
child = DOMUtil.getNextSiblingElement(child);
}
// Element Declaration Representation OK
// 2 If the item's parent is not <schema>, then all of the following must be true:
// 2.1 One of ref or name must be present, but not both.
// 2.2 If ref is present, then all of <complexType>, <simpleType>, <key>, <keyref>, <unique>, nillable, default, fixed, form, block and type must be absent, i.e. only minOccurs, maxOccurs, id are allowed in addition to ref, along with <annotation>.
if (child != null) {
reportSchemaError("src-element.2.2", new Object[]{refAtt.rawname, DOMUtil.getLocalName(child)}, child);
}
} else {
element = null;
}
} else {
element = traverseNamedElement(elmDecl, attrValues, schemaDoc, grammar, false, parent);
}
particle.fMinOccurs = minAtt.intValue();
particle.fMaxOccurs = maxAtt.intValue();
if (element != null) {
particle.fType = XSParticleDecl.PARTICLE_ELEMENT;
particle.fValue = element;
}
else {