• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

please help with text formating in java

 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Manfred,
Thanks a lot for all your help

Regards,
Smita
reply
    Bookmark Topic Watch Topic
  • New Topic