org.millscript.millscript.render
Class HTMLRenderer

java.lang.Object
  extended by org.millscript.millscript.render.AbstractRenderer
      extended by org.millscript.millscript.render.HTMLRenderer
All Implemented Interfaces:
Renderer

public final class HTMLRenderer
extends AbstractRenderer

This class implements MillScripts HTML renderer. It renders to the HTML 4 specification, but may not render valid HTML 4.

The renderers ability to render valid HTML depends on the input it's provided, e.g. supported tags. The main issue with the renderer is that database content can contain HTML tags, as a result we cannot automatically encode "<" characters that occur in string content. When we can parse database content into strings, XmlElement, etc, our ability to render valid documents will greatly improve.


Field Summary
 
Fields inherited from class org.millscript.millscript.render.AbstractRenderer
availableEntities, config, outputCharset, outputEncoder, outputVFile, outputWriter
 
Constructor Summary
HTMLRenderer(Configuration conf, org.millscript.commons.vfs.VFile file)
          Constructs a new HTML renderer, to render to the specified virtual file using the given confguration.
 
Method Summary
 void append(char ch)
          Appends the specified character, allowing the character to be escaped as appropriate for this renderer.
 void appendEscapeFor(char ch)
          Appends the escape sequence for the specified character.
 void appendNoEscape(char ch)
          Appends the specified character, without using an escape sequence.
 void renderDocumentFooter()
          Renders the required document footer for this renderer.
 void renderDocumentHeader()
          Renders the required document header for this renderer.
 void renderObject(java.lang.Object o)
          Renders the specified object using this renderer.
 void renderURI(java.lang.Object x)
          Renders an object as a URI.
 void renderXMLElement(XmlElement x)
          Renders the specified XML element using this renderer.
 
Methods inherited from class org.millscript.millscript.render.AbstractRenderer
append, appendNoEscape, canEncode, render, renderAsDocument, renderAsFragment, renderCDATA, renderXMLComment
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTMLRenderer

public HTMLRenderer(Configuration conf,
                    org.millscript.commons.vfs.VFile file)
Constructs a new HTML renderer, to render to the specified virtual file using the given confguration.

Parameters:
conf - the configuration to get rendering parameters from
file - the virtual output file
Method Detail

append

public void append(char ch)
            throws java.io.IOException
Description copied from interface: Renderer
Appends the specified character, allowing the character to be escaped as appropriate for this renderer.

Parameters:
ch - the character to append, allowing it to be escaped
Throws:
java.io.IOException - thrown if an IO problem occurs
See Also:
Renderer.append(char)

appendEscapeFor

public void appendEscapeFor(char ch)
                     throws java.io.IOException
Description copied from interface: Renderer
Appends the escape sequence for the specified character.

Parameters:
ch - the character to append an escape sequence for
Throws:
java.io.IOException - thrown if an IO problem occurs
See Also:
Renderer.appendEscapeFor(char)

appendNoEscape

public void appendNoEscape(char ch)
                    throws java.io.IOException
Description copied from interface: Renderer
Appends the specified character, without using an escape sequence. This method will raise an alert if the character cannot be appended without an escape sequence.

Parameters:
ch - the character to append, without using an escape sequence.
Throws:
java.io.IOException - thrown if an IO problem occurs
See Also:
Renderer.appendNoEscape(char)

renderDocumentFooter

public void renderDocumentFooter()
                          throws java.io.IOException
Description copied from interface: Renderer
Renders the required document footer for this renderer.

Throws:
java.io.IOException - thrown if an IO problem occurs
See Also:
Renderer.renderDocumentFooter()

renderDocumentHeader

public void renderDocumentHeader()
                          throws java.io.IOException
Description copied from interface: Renderer
Renders the required document header for this renderer.

Throws:
java.io.IOException - thrown if an IO problem occurs
See Also:
Renderer.renderDocumentHeader()

renderObject

public void renderObject(java.lang.Object o)
                  throws java.io.IOException
Description copied from interface: Renderer
Renders the specified object using this renderer.

Parameters:
o - the object to render
Throws:
java.io.IOException - thrown if an IO problem occurs
See Also:
Renderer.renderObject(java.lang.Object)

renderURI

public void renderURI(java.lang.Object x)
               throws java.io.IOException
Renders an object as a URI. This means that ampersands are encoded as "&" and any non ASCII character is UTF-8 encoded and then escaped using the % syntax.

Parameters:
x - the object to render
Throws:
java.io.IOException

renderXMLElement

public void renderXMLElement(XmlElement x)
                      throws java.io.IOException
Description copied from interface: Renderer
Renders the specified XML element using this renderer.

Parameters:
x - the XML element to render
Throws:
java.io.IOException - thrown if an IO problem occurs
See Also:
Renderer.renderXMLElement(org.millscript.millscript.datatypes.XmlElement)


Copyright © 2001-2007 Open World Ltd. All Rights Reserved.