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. Advertisements

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:
    738
    Tor Iver Wilhelmsen
    Sep 17, 2004
  2. Ayrton

    read and write .doc

    Ayrton, Aug 21, 2005, in forum: Java
    Replies:
    1
    Views:
    550
    Roedy Green
    Aug 22, 2005
  3. J Sharman
    Replies:
    4
    Views:
    5,679
    Nikolai Chuvakhin
    Jul 24, 2003
  4. narayan jaiswal
    Replies:
    3
    Views:
    1,741
    Mark Jeffcoat
    Apr 1, 2008
  5. 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:
    204
    Scott Mitchell [MVP]
    Nov 15, 2004
  6. Replies:
    0
    Views:
    285
  7. Parapura  Rajkumar

    indented xml using XML::DOM

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