It looks like Harshana is looking for a way to generate an XML document - not for parsing an XML document.
You could use the XML stream API for that (see the package javax.xml.stream, new in Java 6), or you can just do it the simple way by printing the content out: