XOM (XML Object Model) is a tree based java API for processing XML
by taking the best ideas from SAX and DOM. It is simple, fast and easy to use.
This requires the library xom-1.2.7.jar to be in classpath.
The following example shows converting an XML document to XML string.
/**
* @param args
*/ public static void main(String[] args) {
Element root = new Element("root");
root.appendChild("BE THE CODER");
Document doc = new Document(root);
//Convert the constructed document to String
String result = doc.toXML();
System.out.println(result);
}