• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

HTML templates  RSS feed

 
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am in the middle of writing an fairly big application in Java/Swing. I have a JEditorPane which displays formatted data from a database in HTML format. The key is that I have an HTML template which describes the overall formatting of the data. There are keywords in the HTML file I want to pull out and replace with data from my database. Has somebody already written a package to do HTML templates? If not I guess I will write one from scratch.
Thanks,
Frank
 
Frank Hale
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I figured this out. Its pretty simple, I just use a StreamTokenizer and look for my keywords and replace them with the data I need.
I should have put this in the beginner forum because its pretty simple to do.
Frank
 
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Frank,
Keep posting! Sometimes it is best for us to verbalize the problem - it makes it easier to solve it ourselves. I will soon be doing something similar (hopefully in XML) so any discussions will help me as well!
Paul
 
Frank Hale
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok here is a small program I wrote to learn how to parse an HTML template file and pull out certain key words and replace them with data. This little program echo's its output to the command line. Its probably not the best solution but it seems to work with the little html file I was testing it with.

Here is the html file I used to test with:
<html>
<title>TITLE</title>
<body>CONTENT
</body>
</html>
If you have a much better solution please let me know.
thanks,
Frank

[This message has been edited by Frank Hale (edited June 04, 2000).]
 
A wop bop a lu bob a womp bam boom. Tutti frutti ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!