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

Discussion in 'Java' started by Rolf.Kemper@eu.necel.com, May 31, 2007.

  1. Guest

    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
     
    , May 31, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. lard
    Replies:
    3
    Views:
    1,761
    Raymond DeCampo
    Mar 12, 2006
  2. hongping
    Replies:
    1
    Views:
    741
    hongping
    Nov 2, 2003
  3. dt
    Replies:
    4
    Views:
    495
    CBFalconer
    Dec 31, 2006
  4. Jayden Shui

    How to write output with an indent

    Jayden Shui, Nov 13, 2011, in forum: C++
    Replies:
    8
    Views:
    304
    Larry Evans
    Nov 13, 2011
  5. Roedy Green

    JDK 1.7.0_11 is out.

    Roedy Green, Jan 14, 2013, in forum: Java
    Replies:
    5
    Views:
    302
    Arne Vajhøj
    Jan 17, 2013
Loading...

Share This Page