hat actually print like how i wanted?
Can you explain "how I wanted"?
The site at your link has code to generate Strings of XML and print them on the screen.
Have you tried replacing the 'print to screen' method calls with classes and methods that will write the Strings to a file?
NormR1
Posting Expert
6,677 posts since Jun 2010
Reputation Points: 1,138
Solved Threads: 656
how to write string into file
There are plenty of examples of how to do that.
Try Searching for PrintWriter for sample codes that write Strings to files.
NormR1
Posting Expert
6,677 posts since Jun 2010
Reputation Points: 1,138
Solved Threads: 656
which one is faster
Don't worry about it yet.
If your really interested write some test programs and time them using the System.currentTimeMillis() method at start and end of job.
NormR1
Posting Expert
6,677 posts since Jun 2010
Reputation Points: 1,138
Solved Threads: 656