Easiest way to read a XML doc from file, reformat it and write it indented to a second file?

Discussion in 'Java' started by Raymond Schanks, Jul 15, 2010.

  1. Assume I have a XML docuemnt in file mydoc123.xml
    The XML doc is textually formatted as one long line/string without line breaks.

    Now I want to read this XML doc file into Java, then reformat it so
    that the hierarchy levels are indented in a human radble format "as usual".

    Finally the result should be written to another text file result.xml

    How can I do this most easily (preferable without third party libraries but
    only J2SE built-in functions)?

    Ray
     
    Raymond Schanks, Jul 15, 2010
    #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. Matt
    Replies:
    3
    Views:
    510
    Tor Iver Wilhelmsen
    Sep 17, 2004
  2. Ryan Ternier

    Easiest way giving an XML file to a control

    Ryan Ternier, Nov 15, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    126
    Scott Mitchell [MVP]
    Nov 15, 2004
  3. Replies:
    0
    Views:
    137
  4. Parapura  Rajkumar

    indented xml using XML::DOM

    Parapura Rajkumar, Feb 9, 2009, in forum: Perl Misc
    Replies:
    1
    Views:
    220
    mirod
    Feb 10, 2009
  5. Randell_D
    Replies:
    8
    Views:
    139
    Randell_D
    Mar 24, 2008
Loading...

Share This Page