aspose file tools*
The moose likes Beginning Java and the fly likes please help with text formating in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "please help with text formating in java" Watch "please help with text formating in java" New topic
Author

please help with text formating in java

peter brews
Ranch Hand

Joined: Jan 25, 2002
Posts: 59
The input file format is :
key1[0]| aaaaa |
|bbbb |
|ffff |
|ggggg |

key2[0]|ccccc |
|qqqqq |
|dddddd |

I need to read this data from text file and output should be following xml format:
<root>
<row>
<key1>aaaaa</key1>
<key2>ccccc</key2>
</row>
<row>
<key1>bbbb</key1>
<key2>qqqqq</key2>
</row>
<row>
<key1>ffff</key1>
<key2>ddddd</key2>
</row>
<row>
<key1>gggg</key1>
<key2></key2>
</row>
Please advise what will be the best way to get this output.
Thanks for all your help
smita
peter brews
Ranch Hand

Joined: Jan 25, 2002
Posts: 59
so far I have wrote this:

I would appreciate if any body can advise how to proceed next to get desired output
[ January 28, 2002: Message edited by: Cindy Glass ]
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Smita,
I would break up the reading and writing so that you have a known format when you get to the writer. Unless the input file is huge and memory is low the approach below should work.

Enjoy,
Manfred.
peter brews
Ranch Hand

Joined: Jan 25, 2002
Posts: 59
Manfred,
Thanks a lot for all your help

Regards,
Smita
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: please help with text formating in java
 
Similar Threads
Really Challenging...HelpMe..java.Util - very Urgent
Problem~~
how to get plain text in file using print stream
Help generating JSON data - I am using FlexJSON lib
MultiComponent JTable