Java tutorial
import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLStreamWriter; public class Main { public static void main(String[] args) throws Exception { XMLOutputFactory xof = XMLOutputFactory.newFactory(); XMLStreamWriter xsw = xof.createXMLStreamWriter(System.out); xsw.writeStartDocument(); xsw.writeStartElement("response"); xsw.writeStartElement("message"); xsw.writeCharacters("1 < 2"); xsw.writeEndDocument(); xsw.close(); } }