org.enhydra.xml.io
Class HTMLFormatter

java.lang.Object
  |
  +--org.enhydra.xml.io.BaseDOMFormatter
        |
        +--org.enhydra.xml.io.HTMLFormatter
All Implemented Interfaces:
DOMTraversal.Handler, Formatter

final class HTMLFormatter
extends BaseDOMFormatter
implements Formatter

Formatter for outputting a HTML DOM as a HTML text document.


Fields inherited from class org.enhydra.xml.io.BaseDOMFormatter
ATTR_QUOTE_CHAR, ATTR_QUOTE_CHAR_ENTITY_REF, fDocType, fDocument, fDynamicFormattedElementCount, fOptions, fOut, fPreFormatMode, fPreFormattedElementCount, fPrettyPrinting, fPublicId, fSystemId, fTraverser, fUsePreFormattedAttrText, fUsePreFormattedElements, fUsePreFormattedText, MAX_ENTITY_QUICK_CHECK_CHAR
 
Constructor Summary
HTMLFormatter(Node node, OutputOptions outputOptions, boolean forPreFormatting)
          Constructor.
 
Method Summary
(package private) static void ()
          Static constructor.
protected  String getCharacterEntity(char textChar)
          Get a character entity name for a character.
(package private) static OutputOptions getDefaultOutputOptions()
          Get the default OutputOptions for a document formatter with this formatter.
 void handleAttr(Attr attr)
          Handler called for Attr nodes.
 void handleCDATASection(CDATASection cdata)
          Handler called for CDATASection nodes.
 void handleDocument(Document document)
          Handler called for Document nodes.
 void handleDocumentFragment(DocumentFragment documentFragment)
          Handler called for DocumentFragment nodes; just process children.
 void handleDocumentType(DocumentType documentType)
          Handler called for Document nodes; should never be called.
 void handleElement(Element element)
          Handler called for Element nodes.
 void handleProcessingInstruction(ProcessingInstruction pi)
          Handler called for ProcessingInstruction nodes.
 void handleText(Text text)
          Handler called for Text nodes.
protected  void writeOpenTag(Element element, String tagName, boolean hasChildren)
          Write an element open tag.
 
Methods inherited from class org.enhydra.xml.io.BaseDOMFormatter
getDynamicFormattedElementCount, getDynamicFormattedTextCount, getMIMEEncoding, getPreFormattedElementCount, getPreFormattedTextCount, handleComment, handleEntity, handleEntityReference, handleNotation, preFormatNode, printIndent, usedPreFormattedElements, usedPreFormattedText, write, writeAttributeValue, writeln, writeText
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.enhydra.xml.io.Formatter
getDynamicFormattedElementCount, getDynamicFormattedTextCount, getMIMEEncoding, getPreFormattedElementCount, getPreFormattedTextCount, preFormatNode, usedPreFormattedElements, usedPreFormattedText, write
 

Constructor Detail

HTMLFormatter

public HTMLFormatter(Node node,
                     OutputOptions outputOptions,
                     boolean forPreFormatting)
Constructor.
Method Detail

static void ()
Static constructor.

getDefaultOutputOptions

static OutputOptions getDefaultOutputOptions()
Get the default OutputOptions for a document formatter with this formatter. The encoding will not be set, which signals to use the default encoding.

getCharacterEntity

protected final String getCharacterEntity(char textChar)
Description copied from class: BaseDOMFormatter
Get a character entity name for a character. This is the slow-path, so its ok this is an abstract method call.
Overrides:
getCharacterEntity in class BaseDOMFormatter
See Also:
BaseDOMFormatter.getCharacterEntity(char)

handleDocument

public void handleDocument(Document document)
                    throws IOException
Handler called for Document nodes.
See Also:
DOMTraversal.Handler.handleDocument(org.w3c.dom.Document)

handleDocumentType

public void handleDocumentType(DocumentType documentType)
                        throws IOException
Handler called for Document nodes; should never be called.
See Also:
DOMTraversal.Handler.handleDocumentType(org.w3c.dom.DocumentType)

handleDocumentFragment

public void handleDocumentFragment(DocumentFragment documentFragment)
Handler called for DocumentFragment nodes; just process children.
See Also:
DOMTraversal.Handler.handleDocumentFragment(org.w3c.dom.DocumentFragment)

handleAttr

public void handleAttr(Attr attr)
                throws IOException
Handler called for Attr nodes.
See Also:
DOMTraversal.Handler.handleAttr(org.w3c.dom.Attr)

writeOpenTag

protected final void writeOpenTag(Element element,
                                  String tagName,
                                  boolean hasChildren)
                           throws IOException
Write an element open tag. The hasChildren option is ignored.
Overrides:
writeOpenTag in class BaseDOMFormatter

handleElement

public void handleElement(Element element)
                   throws IOException
Handler called for Element nodes.

This optionally corrects problem cases for browsers:

See Also:
DOMTraversal.Handler.handleElement(org.w3c.dom.Element)

handleProcessingInstruction

public void handleProcessingInstruction(ProcessingInstruction pi)
                                 throws IOException
Handler called for ProcessingInstruction nodes.
See Also:
DOMTraversal.Handler.handleProcessingInstruction(org.w3c.dom.ProcessingInstruction)

handleCDATASection

public void handleCDATASection(CDATASection cdata)
                        throws IOException
Handler called for CDATASection nodes. Non-standard extension: outputs data as-is.
See Also:
DOMTraversal.Handler.handleCDATASection(org.w3c.dom.CDATASection)

handleText

public final void handleText(Text text)
                      throws IOException
Handler called for Text nodes.
Overrides:
handleText in class BaseDOMFormatter
See Also:
DOMTraversal.Handler.handleText(org.w3c.dom.Text)


Copyright © 1999-2002 enhydra.org (Mark Diekhans, David Li, Richard Kunze). All Rights reserved.