Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > text to html conversion

Reply
Thread Tools

text to html conversion

 
 
Yashwant
Guest
Posts: n/a
 
      11-17-2005
I want some information and documentation about how to convert text to
html using java? can anyone please help..

 
Reply With Quote
 
 
 
 
Mitja Trampus
Guest
Posts: n/a
 
      11-17-2005
Yashwant wrote:
> I want some information and documentation about how to convert text to
> html using java? can anyone please help..
>

Google JSP (java server pages) and/or Tomcat if you want it
done on the fly. I guess there are other options still.
If you just want to create html files as such, I don't see
what special instruction you could use. Grab the text, add
html tags and write into a file.
 
Reply With Quote
 
 
 
 
Andy Dingley
Guest
Posts: n/a
 
      11-17-2005
On 17 Nov 2005 12:51:49 -0800, "Yashwant" <(E-Mail Removed)> wrote:

>I want some information and documentation about how to convert text to
>html using java?


1) What are you trying to do ? A one-off conversion, with maybe an
update every few weeks or is this a continuing dynamic task ?

2) Why Java ? There are lots of techniques out there, don't tie
yourself into a particular one before you're forced to.

3) What is "text" ? Is this simply plain text? Does it have paragraph
breaks in it (such as a blank line)? Or does it have some attempt at
full formatting in it?


If this was a one-off, then I'd probably do it with Perl because it's
simple and convenient. In the simplest case you just need to write out a
standard header and footer (probably best to read this from a template
file) and then insert the text file into the middle of it. You use Perl
rather than SSI because there's probably a regex in there that
recognises a blank line and turns it into </p><p> markup.

If it's a dynamic case, then look at what you can get hosted on the
server you need to use. This is more likely to be PHP than Java and the
problem is so trivial that you could do it with any server-side
scripting tool.


 
Reply With Quote
 
Sid Ismail
Guest
Posts: n/a
 
      11-17-2005
On 17 Nov 2005 12:51:49 -0800, "Yashwant" <(E-Mail Removed)>
wrote:

: I want some information and documentation about how to convert text to
: html using java? can anyone please help..
:



http://www.cybermatrix.com/txt2html.html
Maybe this is what you want?

Sid

 
Reply With Quote
 
Toby Inkster
Guest
Posts: n/a
 
      11-18-2005
Yashwant wrote:

> I want some information and documentation about how to convert text to
> html using java?


My Java is a little rusty, but...

class TextToHTML
{
private String starttag = "\n<pre>";
private String finaltag = "</pre>\n";

public String convert (String text)
{
String html;

html = text.replaceAll("&", "&amp;");
html = html.replaceAll("<", "&lt;");

return starttag + html + finaltag;
}
}

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

 
Reply With Quote
 
Toby Inkster
Guest
Posts: n/a
 
      11-18-2005
Andy Dingley wrote:

> You use Perl rather than SSI because there's probably a regex in there
> that recognises a blank line and turns it into </p><p> markup.


s/^\s*$/<\/p><p>/g;

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

 
Reply With Quote
 
Jim Higson
Guest
Posts: n/a
 
      11-18-2005
Toby Inkster wrote:

> Andy Dingley wrote:
>
>> You use Perl rather than SSI because there's probably a regex in there
>> that recognises a blank line and turns it into </p><p> markup.

>
> s/^\s*$/<\/p><p>/g;
>


Except the g probably isn't needed, unless you need the abilty to detect
more than one blank line per line
 
Reply With Quote
 
Toby Inkster
Guest
Posts: n/a
 
      11-18-2005
Jim Higson wrote:

> more than one blank line per line


It's a possibility.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extract Text to HTML, Form Filling & Better PDF to Image Conversion sherazam Java 0 09-27-2011 11:36 AM
PSD to XHTML Conversion Services and PSD to HTML CSS ConversionServices, PSD to Joomla, Drupal, Wordpress Conversion xhtml champs Python 0 06-21-2011 11:59 AM
PSD to XHTML Conversion Services and PSD to HTML CSS ConversionServices, PSD to Joomla, Drupal, Wordpress Conversion PSD to XHTML Conversion Services and PSD to HTML CSS Conversion Services, PSD to Joomla, Drupal, Wor VHDL 0 04-25-2011 06:43 AM
conversion operator and conversion ctor subramanian100in@yahoo.com, India C++ 2 09-15-2009 12:46 PM
Multiple PDF, PPT, DOC to html or text conversion osiceanu ASP .Net 4 02-21-2008 05:04 PM



Advertisments