Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / September 2003

Tip: Looking for answers? Try searching our database.

Text parser

Thread view: 
Martin Mozina - 19 Sep 2003 11:21 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.

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



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.