Hello members,
I am very new in Java programming, I want some help from you.
Actually I have one file named as "list01.txt" in which the content
is in following format
Record # 1
Au: Kuzur, A D
Au: Dito, Bolte
Ti: Elements of semantic web.
Pu: Nasadac
Pl: New Delhi
Record # 2
Au: Kumar, Vinit
Ti: Learning how to learn.
Pu: Pooja
Pl: Bangalore
Record # 3
Au: Pandey, Anand K
Ti: Emerging minds.
Pu: Lakhotia
Pl: Varanasi
what I am trying to do is to get output in some new files in following
format
In file record1.txt
<author> Kuzur, A D</author>
<author>Dito, Bolte </author>
<title> Elements of semantic web.</title>
<publisher> Nasadac</publisher>
<place>New Delhi</place>
In file "record2.txt"
<author> Kumar, Vinit</author>
<title> Learning how to learn.</title>
<publisher> Pooja</publisher>
<place>Bangalore</place>
In file "record3.txt"
<author> Pandey, Anand K</author>
<title> Emerging minds.</title>
<publisher> Lakhotia</publisher>
<place> Varanasi</place>
can anybody help me I am new to Java.
thanks.
GArlington - 17 Mar 2008 12:16 GMT
> Hello members,
>
[quoted text clipped - 20 lines]
> Pu: Lakhotia
> Pl: Varanasi
You will need (custom) file reader to get this file format into XML-
like document.
> what I am trying to do is to get output in some new files in following
> format
[quoted text clipped - 20 lines]
> can anybody help me I am new to Java.
> thanks.
And then you can choose any XML processor/parser to do that.
Roedy Green - 17 Mar 2008 13:07 GMT
On Mon, 17 Mar 2008 03:55:15 -0700 (PDT), vinitbhu
<vinitbhu06@gmail.com> wrote, quoted or indirectly quoted someone who
said :
>Au: Pandey, Anand K
you can read the file with CSVReader. Just tell is your field
separator is a ':' insteao of the usual ','.
See http://mindprod.com/jgloss/csv.html

Signature
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Mark Space - 17 Mar 2008 16:43 GMT
> On Mon, 17 Mar 2008 03:55:15 -0700 (PDT), vinitbhu
> <vinitbhu06@gmail.com> wrote, quoted or indirectly quoted someone who
[quoted text clipped - 6 lines]
>
> See http://mindprod.com/jgloss/csv.html
I would not do this, just because it would be easy for a book title to
have ":" in it.
I'd have to see the actual file format spec, but it looks like the
identifier for the record type is always two letters at the beginning of
the line. I'd key off that. Just use readLine(), and check char(0) and
char(1). Dead simple, and bomb proof. Most likely faster too.
Lord Zoltar - 17 Mar 2008 16:25 GMT
You can get the data from the file with regular expressions and
groupings. I haven't tried it, but this expression:
Record\ \#\ ([0-9])\ \n(Au: .+\n){1,}(Ti: .+\n)(Pu: .+\n)(Pl: .+)
would probably match well with what you want.