org.w3c.jigsaw.html
Class HtmlGenerator

java.lang.Object
  extended by org.w3c.jigsaw.html.HtmlGenerator

public class HtmlGenerator
extends java.lang.Object

A simple HTML generator. This class implements an HTML generator that allows to output dynamic HTML content out.


Constructor Summary
HtmlGenerator(java.lang.String title)
          create the HTML generator with the default HTML encoding "ISO8859_1"
HtmlGenerator(java.lang.String title, java.lang.String encoding)
          create the HTML generator with a specific encoding
 
Method Summary
 void addBase(java.lang.String base)
          Add a Base element to the head
 void addLink(HtmlLink link)
          Add a link to the head of this html document
 void addMeta(java.lang.String name, java.lang.String value)
          adds a htt-equiv meta tag to the head of the document
 void addScript(java.lang.String script)
          Add script to this html page
 void addScript(java.lang.String lang, java.lang.String script)
          Add script to this html page
 void addStyle(MimeType type, java.lang.String style)
          Add style to this html page
 void addStyle(java.lang.String style)
          Add style to this html page
 void append(java.lang.String content)
          Append the given string to the document body.
 void append(java.lang.String str1, java.lang.String str2)
          Append the two strings to the document body.
 void append(java.lang.String s1, java.lang.String s2, java.lang.String s3)
           
 void appendAndEscape(java.lang.String content)
          Append the given string, escaping all special characters.
 void close()
          Close the given document: its composition is now finished.
 void emitBODYTag(boolean value)
          Don't emit body tag.
 java.io.InputStream getInputStream()
          Get the input string for reading the document.
 MimeType getMimeType()
          Get this stream MIME type.
 int length()
          Get the length of this html document
 void meta(java.lang.String name, java.lang.String value)
          Deprecated.  
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HtmlGenerator

public HtmlGenerator(java.lang.String title,
                     java.lang.String encoding)
create the HTML generator with a specific encoding

Parameters:
the - title, a String
the - encoding used, also a String

HtmlGenerator

public HtmlGenerator(java.lang.String title)
create the HTML generator with the default HTML encoding "ISO8859_1"

Parameters:
title, - the document title
Method Detail

getMimeType

public MimeType getMimeType()
Get this stream MIME type. This defaults to text/html.


emitBODYTag

public void emitBODYTag(boolean value)
Don't emit body tag. This is usefull in conjunction with the FRAMESET tag, that requires that no BODY tag be emited.

Parameters:
value - If true, a BODY tag will be emited.

appendAndEscape

public void appendAndEscape(java.lang.String content)
Append the given string, escaping all special characters. This can be used only if you know that the string you are inserting doesn't contain HTML tags


addBase

public void addBase(java.lang.String base)
Add a Base element to the head

Parameters:
the - href part of the BASE element

addStyle

public void addStyle(java.lang.String style)
Add style to this html page

See Also:
HtmlStyle

addStyle

public void addStyle(MimeType type,
                     java.lang.String style)
Add style to this html page

See Also:
HtmlStyle

addScript

public void addScript(java.lang.String script)
Add script to this html page

See Also:
HtmlScript

addScript

public void addScript(java.lang.String lang,
                      java.lang.String script)
Add script to this html page

See Also:
HtmlScript

addLink

public void addLink(HtmlLink link)
Add a link to the head of this html document

Parameters:
link - the link

append

public void append(java.lang.String content)
Append the given string to the document body.

Parameters:
The - HTML string to append.

append

public void append(java.lang.String str1,
                   java.lang.String str2)
Append the two strings to the document body. append("x"+"y"); is equivalent but slower than append("x", "y");.

Parameters:
str1 - The first string.
str2 - The second string.

append

public void append(java.lang.String s1,
                   java.lang.String s2,
                   java.lang.String s3)

length

public int length()
Get the length of this html document

Returns:
the length in bytes of the document

close

public void close()
Close the given document: its composition is now finished.


addMeta

public void addMeta(java.lang.String name,
                    java.lang.String value)
adds a htt-equiv meta tag to the head of the document

Parameters:
name - the name of the pseudo http tag
value, - the string value of the pseudo header

meta

public void meta(java.lang.String name,
                 java.lang.String value)
Deprecated. 

See Also:
addMeta

getInputStream

public java.io.InputStream getInputStream()
Get the input string for reading the document.

Returns:
An input stream to get the generated document from.