The only solution I've found is to add the following code
val writer : PrintWriter = new PrintWriter(System.out)XML.write(writer,root,"utf-8",true,null)writer.flush()