java 1.5.0_11: How to indent xml output by DOMImplementationLS and LSSerializer



Dear Experts,
I have to write a DOM Document and I used the dom implementation LS

To serialise the document I used this code:

DOMImplementationLS domImplLS = (DOMImplementationLS)
impl.getFeature("LS", "3.0");
LSSerializer serializer = domImplLS.createLSSerializer();

// create document doShotMap

LSOutput lso = domImplLS.createLSOutput();
FileOutputStream fos = new FileOutputStream(ShotMapFilePath);
lso.setByteStream(fos);
lso.setEncoding("UTF-8");
serializer.write(docShotMap, lso);

How can I achive to indent the result ?

I would like to keep the application portable.

Thanks a lot for your hints

Rolf

.