TUM CCSM Commons

edu.tum.cs.commons.html
Class HTMLWriter

java.lang.Object
  extended by edu.tum.cs.commons.xml.XMLWriter<EHTMLElement,EHTMLAttribute>
      extended by edu.tum.cs.commons.html.HTMLWriter

public class HTMLWriter
extends XMLWriter<EHTMLElement,EHTMLAttribute>

This class is used for writing HTML.

Version:
$Rev: 28096 $
Author:
Benjamin Hummel, $Author: hummelb $
Rating:
GREEN Hash: 8D23F1A3EAAA692885E5A25667EF254D

Nested Class Summary
static class HTMLWriter.HTMLResolver
          The resolver used for the HTMLWriter.
 
Field Summary
 
Fields inherited from class edu.tum.cs.commons.xml.XMLWriter
xmlResolver
 
Constructor Summary
HTMLWriter(java.io.File file, CSSManagerBase cssManager)
          Creates a new writer for HTML documents.
HTMLWriter(java.io.OutputStream stream, CSSManagerBase cssManager)
          Creates a new writer for HTML documents.
HTMLWriter(java.io.PrintWriter writer, CSSManagerBase cssManager)
          Creates a new writer for HTML documents.
 
Method Summary
 void addAttribute(EHTMLAttribute attribute, java.lang.Object value)
          Adds an attribute to the currently open element but checks in addition if the attribute may be added at all.
 void addRawNewLine()
          Adds a line separator with closing and open tag (see XMLWriter.addNewLine().
 void addRawString(java.lang.String html)
          Adds the given text unprocessed to the writer.
 void addStdHeader()
          This adds a default header for HTML files consisting of the XML header and a DOCTYPE of the xhtml frameset DTD.
 void addStdHeader(java.lang.String encoding)
          This adds a default header for HTML files consisting of the XML header and a DOCTYPE of the xhtml frameset DTD.
 
Methods inherited from class edu.tum.cs.commons.xml.XMLWriter
addCDataSection, addClosedElement, addClosedTextElement, addComment, addHeader, addNewLine, addPublicDocTypeDefintion, addText, close, closeElement, escape, flush, getCurrentElement, getWriter, openElement, openElement, setSuppressLineBreaks
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTMLWriter

public HTMLWriter(java.io.File file,
                  CSSManagerBase cssManager)
           throws java.io.IOException
Creates a new writer for HTML documents.

Parameters:
file - the file to write to.
Throws:
java.io.IOException

HTMLWriter

public HTMLWriter(java.io.OutputStream stream,
                  CSSManagerBase cssManager)
Creates a new writer for HTML documents.

Parameters:
stream - the stream to print to.

HTMLWriter

public HTMLWriter(java.io.PrintWriter writer,
                  CSSManagerBase cssManager)
Creates a new writer for HTML documents.

Parameters:
writer - the writer to print to.
Method Detail

addStdHeader

public void addStdHeader(java.lang.String encoding)
This adds a default header for HTML files consisting of the XML header and a DOCTYPE of the xhtml frameset DTD.

XML version is set to "1.0", encoding provided by a parameter, and doc type definition to XHTML 1.0 Frameset.


addStdHeader

public void addStdHeader()
This adds a default header for HTML files consisting of the XML header and a DOCTYPE of the xhtml frameset DTD.

XML version is set to "1.0", encoding to "UTF-8", and doc type definition to XHTML 1.0 Frameset.


addRawString

public void addRawString(java.lang.String html)
Adds the given text unprocessed to the writer. This is useful for adding chunks of generated XML to avoid having the brackets escaped. Made this public here.

Overrides:
addRawString in class XMLWriter<EHTMLElement,EHTMLAttribute>

addRawNewLine

public void addRawNewLine()
Adds a line separator with closing and open tag (see XMLWriter.addNewLine().


addAttribute

public void addAttribute(EHTMLAttribute attribute,
                         java.lang.Object value)
Adds an attribute to the currently open element but checks in addition if the attribute may be added at all.

Overrides:
addAttribute in class XMLWriter<EHTMLElement,EHTMLAttribute>
Parameters:
attribute - the attribute to create
value - its value
Throws:
HTMLWriterException - if the attribute is not allowed for the current element.

TUM CCSM Commons

TUM CCSM Commons - 2.7