// all the sbml element namespaces are registered to the writer in the writeAnnotation method
// call the writeAnnotation, indicating that we are building an xml fragment
writeAnnotation(sbase, outputDocument, writer, 0, true);
writer.writeEndDocument();
writer.close();
annotationStr = stream.toString();
} catch (XMLStreamException e) {
e.printStackTrace();