    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class org.w3c.jigsaw.html.HtmlGenerator

    java.lang.Object
       |
       +----org.w3c.jigsaw.html.HtmlGenerator

public class HtmlGenerator
extends Object

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

##

HtmlGenerator(String)

##

addBase(String)
  Add a Base element to the head
addLink(HtmlLink)
  Add a link to the head of this html document
addStyle(MimeType, String)
  Add style to this html page
addStyle(String)
  Add style to this html page
append(String)
  Append the given string to the document body.
append(String, String)
  Append the two strings to the document body.
append(String, String, String)
appendAndEscape(String)
  Append the given string, escaping all special characters.
close()
  Close the given document: its composition is now finished.
emitBODYTag(boolean)
  Don't emit body tag.
getInputStream()
  Get the input string for reading the document.
getMimeType()
  Get this stream MIME type.
length()
  Get the length of this html document
meta(String, String)

##

HtmlGenerator

     public HtmlGenerator(String title)

##

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(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(String base)

  Add a Base element to the head

  Parameters:
    the - href part of the BASE element

addStyle

     public void addStyle(String style)

  Add style to this html page

  See Also:
    HtmlStyle

addStyle

     public void addStyle(MimeType type,
                          String style)

  Add style to this html page

  See Also:
    HtmlStyle

addLink

     public void addLink(HtmlLink link)

  Add a link to the head of this html document

  Parameters:
    link - the link

append

     public void append(String content)

  Append the given string to the document body.

  Parameters:
    The - HTML string to append.

append

     public void append(String str1,
                        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(String s1,
                        String s2,
                        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.

  Returns:
    The content length for this document.

meta

     public void meta(String name,
                      String value)

getInputStream

     public InputStream getInputStream()

  Get the input string for reading the document.

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

    All Packages  Class Hierarchy  This Package  Previous  Next  Index