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