// If the element is an annotation and the contextObject is an
// Annotation instance,
// we need to add the namespace to the 'annotationNamespaces' HashMap of
// annotation.
if (contextObject instanceof Annotation) {
Annotation annotation = (Annotation) contextObject;
if (elementName.equals("annotation") && (annotation.getNonRDFannotation() != null) && (!annotation.getNonRDFannotation().contains("layout"))) {
// Hack added to be able to parse properly the render annotation that are
// stored inside: '<annotation xmlns="http://www.sbml.org/sbml/level2">'
// It would make problem for models that contain the word layout in the non RDF annotation part as well as some namespace
// declared on the top level annotation element... !!
// The problem will go away as soon as the new annotation parsing is in place.
// The namespaces are store using the SBMLCoreParser for the annotation element
return;
}
if (prefix.trim().length() == 0) {
annotation.appendNoRDFAnnotation(" " + localName + "=\"" + URI + "\"");
} else {
annotation.appendNoRDFAnnotation(" " + prefix + ":" + localName + "=\"" + URI + "\"");
}
annotation.appendNoRDFAnnotation("");
// If the attribute is the last attribute of its element, we need to
// close the element tag.
if (isLastNamespace && !hasAttributes) {
annotation.appendNoRDFAnnotation(">");
}
}
// If the namespaces are declared in the sbml node, we need to add the
// namespace to
// the 'SBMLDocumentNamespaces' map of the SBMLDocument instance.