I have created XML file,but I can\'t view it/output it.I know there is no way to output created XML file.
Can anyone please suggest what is better way of creating xm
What about using the DOMInternalRepresentation class? Despite its name, it's part of the public API and has existed since JDE 4.0.0. Using the DOMInternalReprestationClass you can write the Document to an XMLWriter.
For example, to write to a ByteArrayOutputStream (making it handy to send over a Connection):
ByteArrayOutputStream os = new ByteArrayOutputStream();
XMLWriter xw = new XMLWriter(os);
DOMInternalRepresentation.parse( myDocument, xw );
Naturally, you can use a FileOutputStream to direct the XML output to a file on disc instead of to a byte-array.
(If you can't use external libraries for some reason, this seems like a pretty viable approach)