// an AnnotationParser can only be used for the annotations of a SBML
// component. If the contextObject is not
// an Annotation instance, this parser doesn't process any elements.
if (contextObject instanceof Annotation) {
Annotation annotation = (Annotation) contextObject;
StringBuilder builder = annotation.getAnnotationBuilder();
// If the element is nested, we need to remove the default ending
// tag of the element.
if (isNested && annotation.getNonRDFannotation().endsWith(">")) {
int builderLength = builder.length();
builder.delete(builderLength - 3, builderLength);
}
// If the element is nested, we need to add a nested element ending
// tag.
if (isNested) {
annotation.appendNoRDFAnnotation("/>");
}
// else, write a entire ending tag with the name of the element
// (Store the prefix too into the String).
else {
if (!prefix.equals("")) {
annotation.appendNoRDFAnnotation("</" + prefix + ":"
+ elementName + ">");
} else {
annotation.appendNoRDFAnnotation("</" + elementName
+ ">");
}
}
} else {
// There is a syntax error, the node can't be read?