Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Easiest way to read a XML doc from file, reformat it and write it indented to a second file?

Reply
Thread Tools

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

 
 
Raymond Schanks
Guest
Posts: n/a
 
      07-15-2010
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
indented xml using XML::DOM Parapura Rajkumar Perl Misc 1 02-10-2009 10:26 AM
What is the easiest way to read the value of a checkbox? Randell_D Javascript 8 03-24-2008 11:59 PM
cannot I search the doc's contents (doc=file.read) one more times? shaobo.li@gmail.com Ruby 0 01-11-2005 09:18 AM
String[] files = {"a.doc, b.doc"}; VERSUS String[] files = new String[] {"a.doc, b.doc"}; Matt Java 3 09-17-2004 10:28 PM
making indented XML Steve Maring Java 0 01-10-2004 03:13 AM



Advertisments