Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Flat File to XML

 
deep venu
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could nebody suggest how would I go about converting a flat file (plain text, delimited file) into a XML Document?...
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its possible with java or any programming language. The structure of the xml document depends on ur system requirement.
You can aslo try to use xmlspy ,which could convert a delimted text file in to xml.
Is that what u r looking for ?
 
deep venu
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I am trying to write a custom code (in java)
to convert a delimited flat file into a XML file. I wouldn't go for a tool like XML Spy or XMl convert unless its too much of an ordeal to write custome code. If you got a sample code or something which you can share it would be gr8...
thanx...
 
Brian Nice
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aside from just reading the flat file in and using a StringTokenizer to break up the words and manually construct the XML, you can use a custom SAX parser that reads the flat file in, applies an XSL stylesheet as the file is read in, which transforms the "events" into XML.
I haven't done this, but i've just read about it. I'm trying to remember where I read it, if you research it a little you can probably find out more about it.
Brian
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic