// For this to work, the elements need to be completely empty (no whitespace or line return)
writer.setProperty(XMLOutputFactory2.P_AUTOMATIC_EMPTY_ELEMENTS, Boolean.TRUE);
// Create an xml fragment to avoid having the xml declaration
SMRootFragment outputDocument = SMOutputFactory.createOutputFragment(writer);
// create the sbmlNamespace variable
String sbmlNamespace = JSBML.getNamespaceFrom(sbase.getLevel(), sbase.getVersion());
SMOutputContext context = outputDocument.getContext();
SMNamespace namespace = context.getNamespace(sbmlNamespace);
namespace.setPreferredPrefix("");
// all the sbml element namespaces are registered to the writer in the writeAnnotation method