if (systemAttr == null && publicAttr == null) {
reportSchemaError("PublicSystemOnNotation", null, elmNode);
publicAttr = "missing";
}
XSNotationDecl notation = new XSNotationDecl();
notation.fName = nameAttr;
notation.fTargetNamespace = schemaDoc.fTargetNamespace;
notation.fPublicId = publicAttr;
notation.fSystemId = systemAttr;
//check content
Element content = DOMUtil.getFirstChildElement(elmNode);
XSAnnotationImpl annotation = null;
if (content != null && DOMUtil.getLocalName(content).equals(SchemaSymbols.ELT_ANNOTATION)) {
annotation = traverseAnnotationDecl(content, attrValues, false, schemaDoc);
content = DOMUtil.getNextSiblingElement(content);
}
else {
String text = DOMUtil.getSyntheticAnnotation(elmNode);
if (text != null) {
annotation = traverseSyntheticAnnotation(elmNode, text, attrValues, false, schemaDoc);
}
}
XSObjectList annotations;
if (annotation != null) {
annotations = new XSObjectListImpl();
((XSObjectListImpl) annotations).addXSObject(annotation);
} else {
annotations = XSObjectListImpl.EMPTY_LIST;
}
notation.fAnnotations = annotations;
if (content!=null){
Object[] args = new Object [] {SchemaSymbols.ELT_NOTATION, "(annotation?)", DOMUtil.getLocalName(content)};
reportSchemaError("s4s-elt-must-match.1", args, content);
}
if (grammar.getGlobalNotationDecl(notation.fName) == null) {
grammar.addGlobalNotationDecl(notation);
}
// also add it to extended map
final String loc = fSchemaHandler.schemaDocument2SystemId(schemaDoc);
final XSNotationDecl notation2 = grammar.getGlobalNotationDecl(notation.fName, loc);
if (notation2 == null) {
grammar.addGlobalNotationDecl(notation, loc);
}
// handle duplicates