public static String toMathML(ASTNode astNode) {
String mathML = "";
StringWriter stream = new StringWriter();
SMOutputFactory smFactory = new SMOutputFactory(WstxOutputFactory
.newInstance());
try {
XMLStreamWriter writer = smFactory.createStax2Writer(stream);
MathMLXMLStreamCompiler compiler = new MathMLXMLStreamCompiler(writer, " ");
boolean isSBMLNamespaceNeeded = compiler.isSBMLNamespaceNeeded(astNode);
writer.writeStartDocument();
writer.writeCharacters("\n");