int finalProperty = finalAttr == null ? schemaDoc.fFinalDefault : finalAttr.intValue();
// annotation?,(list|restriction|union)
Element child = DOMUtil.getFirstChildElement(simpleTypeDecl);
XSAnnotationImpl [] annotations = null;
if (child != null && DOMUtil.getLocalName(child).equals(SchemaSymbols.ELT_ANNOTATION)) {
XSAnnotationImpl annotation = traverseAnnotationDecl(child, attrValues, false, schemaDoc);
if (annotation != null)
annotations = new XSAnnotationImpl [] {annotation};
child = DOMUtil.getNextSiblingElement(child);
}
else {
String text = DOMUtil.getSyntheticAnnotation(simpleTypeDecl);
if (text != null) {
XSAnnotationImpl annotation = traverseSyntheticAnnotation(simpleTypeDecl, text, attrValues, false, schemaDoc);
annotations = new XSAnnotationImpl[] {annotation};
}
}
// (list|restriction|union)
if (child == null) {
reportSchemaError("s4s-elt-must-match.2", new Object[]{SchemaSymbols.ELT_SIMPLETYPE, "(annotation?, (restriction | list | union))"}, simpleTypeDecl);
return errorType(name, schemaDoc.fTargetNamespace, XSConstants.DERIVATION_RESTRICTION);
}
// derivation type: restriction/list/union
String varietyProperty = DOMUtil.getLocalName(child);
short refType = XSConstants.DERIVATION_RESTRICTION;
boolean restriction = false, list = false, union = false;
if (varietyProperty.equals(SchemaSymbols.ELT_RESTRICTION)) {
refType = XSConstants.DERIVATION_RESTRICTION;
restriction = true;
}
else if (varietyProperty.equals(SchemaSymbols.ELT_LIST)) {
refType = XSConstants.DERIVATION_LIST;
list = true;
}
else if (varietyProperty.equals(SchemaSymbols.ELT_UNION)) {
refType = XSConstants.DERIVATION_UNION;
union = true;
}
else {
reportSchemaError("s4s-elt-must-match.1", new Object[]{SchemaSymbols.ELT_SIMPLETYPE, "(annotation?, (restriction | list | union))", varietyProperty}, simpleTypeDecl);
return errorType(name, schemaDoc.fTargetNamespace, XSConstants.DERIVATION_RESTRICTION);
}
// nothing should follow this element
Element nextChild = DOMUtil.getNextSiblingElement(child);
if (nextChild != null) {
reportSchemaError("s4s-elt-must-match.1", new Object[]{SchemaSymbols.ELT_SIMPLETYPE, "(annotation?, (restriction | list | union))", DOMUtil.getLocalName(nextChild)}, nextChild);
}
// General Attribute Checking: get base/item/member types
Object[] contentAttrs = fAttrChecker.checkAttributes(child, false, schemaDoc);
QName baseTypeName = (QName)contentAttrs[restriction ?
XSAttributeChecker.ATTIDX_BASE :
XSAttributeChecker.ATTIDX_ITEMTYPE];
Vector memberTypes = (Vector)contentAttrs[XSAttributeChecker.ATTIDX_MEMBERTYPES];
//content = {annotation?,simpleType?...}
Element content = DOMUtil.getFirstChildElement(child);
//check content (annotation?, ...)
if (content != null && DOMUtil.getLocalName(content).equals(SchemaSymbols.ELT_ANNOTATION)) {
XSAnnotationImpl annotation = traverseAnnotationDecl(content, contentAttrs, false, schemaDoc);
if (annotation != null ) {
if(annotations == null) {
annotations = new XSAnnotationImpl [] {annotation};
}
else {
XSAnnotationImpl [] tempArray = new XSAnnotationImpl[2];
tempArray[0] = annotations[0];
annotations = tempArray;
annotations[1] = annotation;
}
}
content = DOMUtil.getNextSiblingElement(content);
}
else {
String text = DOMUtil.getSyntheticAnnotation(child);
if (text != null) {
XSAnnotationImpl annotation = traverseSyntheticAnnotation(child, text, contentAttrs, false, schemaDoc);
if (annotations == null) {
annotations = new XSAnnotationImpl [] {annotation};
}
else {
XSAnnotationImpl [] tempArray = new XSAnnotationImpl[2];