• Post Reply Bookmark Topic Watch Topic
  • New Topic

data on specific place in text file with xml or without

 
Georgios Chatziefstratiou
Ranch Hand
Posts: 106
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there.

I have some data that i want to extract them on text file on specific order and column does anyone have any idea how can i do that?
I have think of use xml and then drop them on text file but i am not sure any suggestion on that , what can i do?
The problem is that i want that data(name ...)be place on a specific line and column on the text file.

example

where are ---- is to be empty with space or something else
--------------------------------------name----------------town----------------
--------state------
so on

thanks
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I re read your post multiple times, but unfortunately still cannot understand what problem you are trying to solve. Can you please rephrase?
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, I'm not quite sure what the problem is either (writing such data? reading such data? converting from one format to another? ...), but since you mention data in lines -a.k.a. rows- and columns, maybe the CSV format might do? There are numerous libraries available for reading and writing CSV; see http://www.coderanch.com/how-to/java/AccessingFileFormats under "Excel".
 
Georgios Chatziefstratiou
Ranch Hand
Posts: 106
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:Yeah, I'm not quite sure what the problem is either (writing such data? reading such data? converting from one format to another? ...), but since you mention data in lines -a.k.a. rows- and columns, maybe the CSV format might do? There are numerous libraries available for reading and writing CSV; see http://www.coderanch.com/how-to/java/AccessingFileFormats under "Excel".

not possible i have excel and i want it to text file.Not CSV.

I am thinking of using POI but what else can i do.How can i make a template so that i read excel then put data to xml and then put them on a text file on a specific place column and row?

Maneesh Godbole wrote:I re read your post multiple times, but unfortunately still cannot understand what problem you are trying to solve. Can you please rephrase?


Hi there thanks for your answer.
So problem is
i want to have this on a txt


I want to have this printed on a text file.
but 2001 starts from the 3 column of the 3 row and so on and to use this form for the rest of the text file.

I am thinking if i can use xml to make a template that the 2001 goes at this exact place (example 5 column 56 row and os on for more input) in this exact row.

does this help a little?

I have though to create an Array and put there every number/word and then put it to the text field but can i do it with xml?
I am thinking of using POI but what else can i do.How can i make a template so that i read excel then put data to xml and then put them on a text file on a specific place column and row?
does this helps?

thanks in advance
 
Sam Gooding
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Georgios Chatziefstratiou wrote:
Ulf Dittmer wrote:Yeah, I'm not quite sure what the problem is either (writing such data? reading such data? converting from one format to another? ...), but since you mention data in lines -a.k.a. rows- and columns, maybe the CSV format might do? There are numerous libraries available for reading and writing CSV; see http://www.coderanch.com/how-to/java/AccessingFileFormats under "Excel".

not possible i have excel and i want it to text file.Not CSV.

I am thinking of using POI but what else can i do.How can i make a template so that i read excel then put data to xml and then put them on a text file on a specific place column and row?

Maneesh Godbole wrote:I re read your post multiple times, but unfortunately still cannot understand what problem you are trying to solve. Can you please rephrase?


Hi there thanks for your answer.
So problem is
i want to have this on a txt


I want to have this printed on a text file.
but 2001 starts from the 3 column of the 3 row and so on and to use this form for the rest of the text file.

I am thinking if i can use xml to make a template that the 2001 goes at this exact place (example 5 column 56 row and os on for more input) in this exact row.

does this help a little?

I have though to create an Array and put there every number/word and then put it to the text field but can i do it with xml?
I am thinking of using POI but what else can i do.How can i make a template so that i read excel then put data to xml and then put them on a text file on a specific place column and row?
does this helps?

thanks in advance


I am not sure if I understand what you're trying to do, but it seems like you're trying to carry over the concept of of "columns" and "rows" into a file that you read and write from. Even text readers don't save their own files to disk like that. If you opened up a text file (not using a text editor to open it) you'd just see a bunch of bytes and letters and symbols running together.

The APPEARANCE of columns and rows in text files only happens as a result of (and when) the text editor program reads in the bytes of a file , and INTERPRETS what it finds as rows and columns and PRESENTS that to you, the user of the text editor program.

This change from bytes -> interpretation->presentation is made possible because the file is written in a "certain way" that the file editor knows about. That "certain way" is called a "file format". A file format is nothing more than an public understanding of how to interpret the bytes of a file.

You can save it in XML or CSV or any other way you want so long as your program knows how to interpret that CSV or XML to show rows and columns when the file is loaded.

It occurs to me that you may have the demand that the file be openable as a text file , say in .txt file format. If that's the case then you have to save the file to .txt file format, which can be done using one of Swings Document reading / writing components and libraries; they "know" about .txt files, which is to say they can read and write them.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!