aspose file tools*
The moose likes XML and Related Technologies and the fly likes text file(not delimiter separated) to xml conversion. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "text file(not delimiter separated) to xml conversion." Watch "text file(not delimiter separated) to xml conversion." New topic
Author

text file(not delimiter separated) to xml conversion.

Hemang Thanki
Greenhorn

Joined: Jan 24, 2005
Posts: 18
Hi,

I need to convert .txt file to .xml. This task looks so simple. But actually, the .txt file is not delimiter separated. I googled and found that if the file is delimiter separated, that can be done using simple java program(As Balaji replied in one of the topic in the XML forum).

Text file example:
==================
00000000000000000000000000000000000000000000000<b>3100</b> A 784784784CMCC C 2005-05-030000-002006-02-251958-11-1200 ENU 000000000 0000001 02 00000000015000002& &AYNIE
========================================================================
Now based on the position I need to extract the data. That is already done.
This data e.g. <b>3100</b>, needs to be the tag in the .xml file based on some condition. There could be nesting of tags possible. I know the position of the data.

Question: How do I convert this data to .xml? Is there any utility(jar) which helps me creating xml?

Thanks a ton in advance.

Regards,
Hemang
Hemang Thanki
Greenhorn

Joined: Jan 24, 2005
Posts: 18
In my previous query text file does not contain <b>3100</b>. It is only 3100.
Sorry for that.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18987
    
    8

Try reading this chapter:

http://www.cafeconleche.org/books/xmljava/chapters/ch08s05.html

and see if it helps.
Hemang Thanki
Greenhorn

Joined: Jan 24, 2005
Posts: 18
Hey Paul,
Thanks for the help.
Actually, I googled and found the castor is the proper answer for my query...

Thanks again...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: text file(not delimiter separated) to xml conversion.