[Rob]: The thing is, text does not have any real markup. You could read it all in, create a <p> block for every piece of code until an empty line is encountered, create ordered lists, unordered lists, create links for every URL in the text, but in the end, it will still look quite similar to the <pre> block. Well, it is possible to make a few substantial improvements. E.g. the <pre> block will prevent
word wrapping, which could well be a problem for some documents. So replacing each line break with <br> or <p> could well be an improvement.
Anyway Jay, the thing is that there's no
standard way to do this. There are a number of aesthetic choices to make, depending on the nature of the text you're dealing with. Your best bet may be to code up something that reads each line, loops through each character, converts special characters to escape sequences, and appaned <br/> at the end of each line. Maybe leading spaces on a line could become . Depending on how you like the results, you can modify as necessary.
Or you can google for"java "text to html"" to look for existing code to do this sort of thing. A couple possibilities are this
Text2HTML filter, or
MarkdownJ. I've never used either, and don't know how close they may be to what you want.
[ November 02, 2007: Message edited by: Jim Yingst ]