As lasse mentioned, I tyhink the straigt forward way to do it is to write it using a fileoutputstream as follows !!!
DOM does provide an Interface called DOMImplementation that allows you to create a new Document based on a DTD. You can then add elemnts and attributes using the Document interface. I am not sure if tehre is one for schema
.
The methods defined in teh interface are as follows
An example of doing ot using this would be as follows
Hope this helps
hari