net.sf.joost.emitter
Class HtmlEmitter

java.lang.Object
  extended bynet.sf.joost.emitter.StxEmitterBase
      extended bynet.sf.joost.emitter.StreamEmitter
          extended bynet.sf.joost.emitter.HtmlEmitter
All Implemented Interfaces:
Constants, ContentHandler, LexicalHandler, StxEmitter

public class HtmlEmitter
extends StreamEmitter

This class implements an emitter for html code.

Version:
$Revision: 1.3 $ $Date: 2004/11/07 12:30:38 $
Author:
Thomas Behrends

Field Summary
private static HashSet emptyHTMLElements
          Empty HTML 4.01 elements according to http://www.w3.org/TR/1999/REC-html401-19991224/index/elements.html
private  boolean insideCDATA
           
private  boolean propOmitXmlDeclaration
          output property: omit-xml-declaration
 
Fields inherited from class net.sf.joost.emitter.StreamEmitter
charsetEncoder, encoding, writer
 
Fields inherited from class net.sf.joost.emitter.StxEmitterBase
 
Fields inherited from interface net.sf.joost.Constants
DEBUG, DEFAULT_ENCODING, FEAT_NS, FEAT_NSPREFIX, FEATURE_URI_PREFIX, FUNC_NS, JOOST_EXT_NS, PR_ATTRIBUTES, PR_BUFFER, PR_CHILDREN, PR_CONTINUE, PR_ERROR, PR_SELF, PR_SIBLINGS, STX_NS
 
Constructor Summary
HtmlEmitter(Writer writer, String encoding)
          Constructor
 
Method Summary
 void characters(char[] ch, int start, int length)
          SAX2-Callback - Constructs characters.
 void comment(char[] ch, int start, int length)
          SAX2-Callback - Outputs a comment
 void endCDATA()
          Does nothing
 void endDocument()
          SAX2-Callback - Closing OutputStream.
 void endElement(String uri, String lName, String qName)
          SAX2-Callback - Outputs the element-tag.
 void setOmitXmlDeclaration(boolean flag)
          Defines whether the XML declaration should be omitted, default is false.
 void startCDATA()
          CDATA sections act as "disable-otput-escaping" replacement in HTML (which is of course a kind of a "hack" ...)
 void startDocument()
          SAX2-Callback - Outputs XML-Deklaration with encoding.
 void startElement(String uri, String lName, String qName, Attributes attrs)
          SAX2-Callback
 
Methods inherited from class net.sf.joost.emitter.StreamEmitter
endDTD, endEntity, endPrefixMapping, ignorableWhitespace, newEmitter, newEmitter, newEmitter, newXMLEmitter, processingInstruction, setDocumentLocator, skippedEntity, startDTD, startEntity, startPrefixMapping
 
Methods inherited from class net.sf.joost.emitter.StxEmitterBase
getSystemId, setSystemId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

propOmitXmlDeclaration

private boolean propOmitXmlDeclaration
output property: omit-xml-declaration


insideCDATA

private boolean insideCDATA

emptyHTMLElements

private static final HashSet emptyHTMLElements
Empty HTML 4.01 elements according to http://www.w3.org/TR/1999/REC-html401-19991224/index/elements.html

Constructor Detail

HtmlEmitter

public HtmlEmitter(Writer writer,
                   String encoding)
Constructor

Method Detail

setOmitXmlDeclaration

public void setOmitXmlDeclaration(boolean flag)
Defines whether the XML declaration should be omitted, default is false.

Overrides:
setOmitXmlDeclaration in class StreamEmitter
Parameters:
flag - true: the XML declaration will be omitted; false: the XML declaration will be output

startDocument

public void startDocument()
                   throws SAXException
SAX2-Callback - Outputs XML-Deklaration with encoding.

Throws:
SAXException

endDocument

public void endDocument()
                 throws SAXException
SAX2-Callback - Closing OutputStream.

Throws:
SAXException

startElement

public void startElement(String uri,
                         String lName,
                         String qName,
                         Attributes attrs)
                  throws SAXException
SAX2-Callback

Throws:
SAXException

endElement

public void endElement(String uri,
                       String lName,
                       String qName)
                throws SAXException
SAX2-Callback - Outputs the element-tag.

Throws:
SAXException

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
SAX2-Callback - Constructs characters.

Throws:
SAXException

comment

public void comment(char[] ch,
                    int start,
                    int length)
             throws SAXException
SAX2-Callback - Outputs a comment

Specified by:
comment in interface LexicalHandler
Overrides:
comment in class StreamEmitter
Throws:
SAXException

startCDATA

public void startCDATA()
                throws SAXException
CDATA sections act as "disable-otput-escaping" replacement in HTML (which is of course a kind of a "hack" ...)

Specified by:
startCDATA in interface LexicalHandler
Overrides:
startCDATA in class StreamEmitter
Throws:
SAXException

endCDATA

public void endCDATA()
              throws SAXException
Description copied from class: StreamEmitter
Does nothing

Specified by:
endCDATA in interface LexicalHandler
Overrides:
endCDATA in class StreamEmitter
Throws:
SAXException