omElement.setText(text);
// Serialize
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OMOutputFormat omFormat = new OMOutputFormat();
omFormat.setXmlStreamWriterFilter(new XMLStreamWriterRemoveIllegalChars());
env1.serialize(baos, omFormat);
String xmlText = baos.toString();
System.out.println("Serialized Text = " + xmlText);