A part of my project is to create a .txt file for each person we are working
it. I would like to make a common .txt template with some text that will not
change, and at certain points in the text, I would insert tags with some
query information (name for example) . Using this information and knowledge
about current user, application should create a .txt file specific for this
user.
I could write a parser like that by myself. But if anyone knows for a text
parser in java, that is capable to process text and user specific tags,
would help me a lot.
Martin
Michael Borgwardt - 19 Sep 2003 12:19 GMT
> A part of my project is to create a .txt file for each person we are working
> it. I would like to make a common .txt template with some text that will not
[quoted text clipped - 6 lines]
> parser in java, that is capable to process text and user specific tags,
> would help me a lot.
Sounds exactly like what a JSP server does, though it can do a lot more and may be
overkill.
Stefan Poehn - 19 Sep 2003 12:26 GMT
> A part of my project is to create a .txt file for each person we are working
> it. I would like to make a common .txt template with some text that will not
[quoted text clipped - 6 lines]
> parser in java, that is capable to process text and user specific tags,
> would help me a lot.
Does it make sense to use XML in your application?
You could use a DTD instead of your .txt templates and
XML-files instead of your .txt-files.
And you get a good parser by using Apache's SAX parser.
HTH
Stefan
D Goldman - 19 Sep 2003 18:27 GMT
Martin, why don't you try using java's StringTokenzer (in the util
package). Also if you are trying to extract certain tags from a text
file, then you should consider using an xml file with either SAX, DOM,
or java's xml parser.
Hope this helps,
Daniel Goldman
http://d-goldman.org
> A part of my project is to create a .txt file for each person we are working
> it. I would like to make a common .txt template with some text that will not
[quoted text clipped - 8 lines]
>
> Martin
J. Chris Tilton - 19 Sep 2003 18:46 GMT
jflex is a lightweight easy to use parser - depending upon your application
and the complexity of the data.
> A part of my project is to create a .txt file for each person we are working
> it. I would like to make a common .txt template with some text that will not
[quoted text clipped - 8 lines]
>
> Martin
Roedy Green - 19 Sep 2003 19:21 GMT
>I could write a parser like that by myself. But if anyone knows for a text
>parser in java, that is capable to process text and user specific tags,
>would help me a lot.
The easy way is to use XML then use any XML parser. See
http://mindprod.com/jgloss/xml.html The problem is the format is
verbose.
To roll your own parser, see http://mindprod.com/jgloss/parser.html
If CSV will suffice, try http://mindprod.com/jgloss/csv.html
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Will Hartung - 19 Sep 2003 22:07 GMT
> A part of my project is to create a .txt file for each person we are working
> it. I would like to make a common .txt template with some text that will not
> change, and at certain points in the text, I would insert tags with some
> query information (name for example) . Using this information and knowledge
> about current user, application should create a .txt file specific for this
> user.
The XML option is certainly viable if it only needs to be Human readable vs
Human formatted, and XML is a leveragable skill that can be used in all
sorts of areas, so it worth learning for more than just this simple project.
However, another generic utility is Jakarta Velocity project. While in some
sense it may be a bit of overkill (as it's really a lightweight scripting
language), Velocity is bone simple to use. You can have your own sample
coded and running in 15 minutes. Vastly more easy than a generic XML
framework.
Regards,
Will Hartung
(willh@msoft.com)
Tim Tyler - 29 Sep 2003 12:08 GMT
: I could write a parser like that by myself. But if anyone knows for a text
: parser in java, that is capable to process text and user specific tags,
: would help me a lot.
FreeMarker does something like this:
``FreeMarker is a "template engine"; a generic tool to generate text
output (anything from HTML or RTF to autogenerated source code) based
on templates.''
http://freemarker.sourceforge.net/

Signature
__________
|im |yler http://timtyler.org/ tim@tt1.org