// must have a name
if (strNameAttr == null) {
reportSchemaError("s4s-att-must-appear", new Object[]{"group (global)", "name"}, elmNode);
}
XSGroupDecl group = null;
XSParticleDecl particle = null;
// must have at least one child
Element l_elmChild = DOMUtil.getFirstChildElement(elmNode);
XSAnnotationImpl annotation = null;
if (l_elmChild == null) {
reportSchemaError("s4s-elt-must-match.2",
new Object[]{"group (global)", "(annotation?, (all | choice | sequence))"},
elmNode);
} else {
String childName = l_elmChild.getLocalName();
if (childName.equals(SchemaSymbols.ELT_ANNOTATION)) {
annotation = traverseAnnotationDecl(l_elmChild, attrValues, true, schemaDoc);
l_elmChild = DOMUtil.getNextSiblingElement(l_elmChild);
if (l_elmChild != null)
childName = l_elmChild.getLocalName();
}
if (l_elmChild == null) {
reportSchemaError("s4s-elt-must-match.2",
new Object[]{"group (global)", "(annotation?, (all | choice | sequence))"},
elmNode);
} else if (childName.equals(SchemaSymbols.ELT_ALL)) {
particle = traverseAll(l_elmChild, schemaDoc, grammar, CHILD_OF_GROUP, null);
} else if (childName.equals(SchemaSymbols.ELT_CHOICE)) {
particle = traverseChoice(l_elmChild, schemaDoc, grammar, CHILD_OF_GROUP, null);
} else if (childName.equals(SchemaSymbols.ELT_SEQUENCE)) {
particle = traverseSequence(l_elmChild, schemaDoc, grammar, CHILD_OF_GROUP, null);
} else {
reportSchemaError("s4s-elt-must-match.1",
new Object[]{"group (global)", "(annotation?, (all | choice | sequence))", DOMUtil.getLocalName(l_elmChild)},
l_elmChild);
}
if (l_elmChild != null &&
DOMUtil.getNextSiblingElement(l_elmChild) != null) {
reportSchemaError("s4s-elt-must-match.1",
new Object[]{"group (global)", "(annotation?, (all | choice | sequence))",
DOMUtil.getLocalName(DOMUtil.getNextSiblingElement(l_elmChild))},
DOMUtil.getNextSiblingElement(l_elmChild));
}
// add global group declaration to the grammar
if (strNameAttr != null) {
group = new XSGroupDecl();
group.fName = strNameAttr;
group.fTargetNamespace = schemaDoc.fTargetNamespace;
if (particle != null)
group.fModelGroup = (XSModelGroupImpl)particle.fValue;
group.fAnnotation = annotation;