|
EAF 7.4 Util | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.enhydra.xml.io.ExtHTMLFormatter
public class ExtHTMLFormatter
Formatter for outputting a HTML DOM as a HTML text document.
Field Summary | |
---|---|
protected static char |
ATTR_QUOTE_CHAR
Quote character to use for attribute values. |
protected static java.lang.String |
ATTR_QUOTE_CHAR_ENTITY_REF
Entity reference for attribute value quote character. |
protected org.w3c.dom.DocumentType |
fDocType
DocumentType from document. |
protected org.w3c.dom.Document |
fDocument
Document being formatted. |
protected int |
fDynamicFormattedElementCount
Count of element open tags that were written not using preformatted text. |
protected org.enhydra.xml.io.OutputOptions |
fOptions
The output options. |
protected java.io.Writer |
fOut
Output writer. |
protected boolean |
fPreFormatMode
Are we doing pre-formatting? |
protected int |
fPreFormattedElementCount
Count of preformatted element open tags that were written. |
protected boolean |
fPrettyPrinting
Are we pretty-printing? |
protected java.lang.String |
fPublicId
Public id to use for DOCTYPE, or null if none. |
protected java.lang.String |
fSystemId
System id to use for DOCTYPE, or null if none. |
protected org.enhydra.xml.dom.DOMTraversal |
fTraverser
DOM traverser. |
protected boolean |
fUsePreFormattedAttrText
Should pre-formatted text be use for descendents of attribute nodes. |
protected boolean |
fUsePreFormattedElements
Should pre-formatted Elements be written. |
protected boolean |
fUsePreFormattedText
Should pre-formatted text be written. |
protected static int |
MAX_ENTITY_QUICK_CHECK_CHAR
Maximum character value in an entity quick-check table. |
Fields inherited from interface org.enhydra.util.DOMFormatter |
---|
FORMATTER_NAME |
Constructor Summary | |
---|---|
ExtHTMLFormatter(org.w3c.dom.Node node,
org.enhydra.xml.io.OutputOptions outputOptions,
boolean forPreFormatting)
Constructor. |
Method Summary | |
---|---|
static org.enhydra.xml.io.DocumentInfo |
findDocumentInfo(org.w3c.dom.Document document)
Get the DocumentInfo object, if available. |
protected java.lang.String |
getCharacterEntity(char textChar)
Get a character entity name for a character. |
int |
getDynamicFormattedElementCount()
Get the count of element open tags that were written not using preformatted text. |
int |
getDynamicFormattedTextCount()
Get the count of text nodes that were written not using preformatted text. |
static org.enhydra.xml.io.Formatter |
getFormatter(org.w3c.dom.Node node,
org.enhydra.xml.io.OutputOptions outputOptions,
boolean forPreFormatting)
|
java.lang.String |
getMIMEEncoding()
|
int |
getPreFormattedElementCount()
Get the count of preformatted element open tags that were written. |
int |
getPreFormattedTextCount()
Get the count of preformatted text nodes that were written. |
void |
handleAttr(org.w3c.dom.Attr attr)
Handler called for Attr nodes. |
void |
handleCDATASection(org.w3c.dom.CDATASection cdata)
Handler called for CDATASection nodes. |
void |
handleComment(org.w3c.dom.Comment comment)
Handler called for Comment nodes. |
void |
handleDocument(org.w3c.dom.Document document)
Handler called for Document nodes. |
void |
handleDocumentFragment(org.w3c.dom.DocumentFragment documentFragment)
Handler called for DocumentFragment nodes; just process children. |
void |
handleDocumentType(org.w3c.dom.DocumentType documentType)
Handler called for Document nodes; should never be called. |
void |
handleElement(org.w3c.dom.Element element)
Handler called for Element nodes. |
void |
handleEntity(org.w3c.dom.Entity entity)
Handler called for Entity nodes; should never be called. |
void |
handleEntityReference(org.w3c.dom.EntityReference entityRef)
Handler called for EntityReference nodes. |
void |
handleNotation(org.w3c.dom.Notation notation)
Handler called for Notation nodes; should never be called. |
void |
handleProcessingInstruction(org.w3c.dom.ProcessingInstruction pi)
Handler called for ProcessingInstruction nodes. |
void |
handleText(org.w3c.dom.Text text)
Handler called for Text nodes. |
java.lang.String |
preFormatNode(org.w3c.dom.Node node)
|
protected void |
printIndent()
Print indentation to the current level. |
byte[] |
toBytes(org.w3c.dom.Node document)
|
boolean |
usedPreFormattedElements()
|
boolean |
usedPreFormattedText()
|
void |
write(org.w3c.dom.Node node,
java.io.OutputStream out)
Output a document or any node and its children to a OutputStream. |
void |
write(org.w3c.dom.Node node,
java.io.Writer writer)
Format a Node and children to the specified writer. |
protected void |
writeAttributeValue(org.w3c.dom.Attr attr)
Write an attribute value. |
protected void |
writeln()
Write a newline |
protected void |
writeOpenTag(org.w3c.dom.Element element,
java.lang.String tagName,
boolean hasChildren)
Write an element open tag. |
protected void |
writeText(java.lang.String text)
Write a text string, encoding document type-specific character entities. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final int MAX_ENTITY_QUICK_CHECK_CHAR
protected static final char ATTR_QUOTE_CHAR
protected static final java.lang.String ATTR_QUOTE_CHAR_ENTITY_REF
protected final org.enhydra.xml.io.OutputOptions fOptions
protected java.io.Writer fOut
protected final org.enhydra.xml.dom.DOMTraversal fTraverser
protected final boolean fPreFormatMode
protected final boolean fUsePreFormattedText
protected final boolean fUsePreFormattedAttrText
protected final boolean fUsePreFormattedElements
protected int fPreFormattedElementCount
protected int fDynamicFormattedElementCount
protected final boolean fPrettyPrinting
protected final org.w3c.dom.Document fDocument
protected final org.w3c.dom.DocumentType fDocType
protected final java.lang.String fPublicId
protected final java.lang.String fSystemId
Constructor Detail |
---|
public ExtHTMLFormatter(org.w3c.dom.Node node, org.enhydra.xml.io.OutputOptions outputOptions, boolean forPreFormatting)
Method Detail |
---|
protected final java.lang.String getCharacterEntity(char textChar)
ExtBaseDOMFormatter#getCharacterEntity
public void handleDocument(org.w3c.dom.Document document) throws java.io.IOException
handleDocument
in interface org.enhydra.xml.dom.DOMTraversal.Handler
java.io.IOException
DOMTraversal.Handler.handleDocument(org.w3c.dom.Document)
public void handleDocumentType(org.w3c.dom.DocumentType documentType) throws java.io.IOException
handleDocumentType
in interface org.enhydra.xml.dom.DOMTraversal.Handler
java.io.IOException
DOMTraversal.Handler.handleDocumentType(org.w3c.dom.DocumentType)
public void handleDocumentFragment(org.w3c.dom.DocumentFragment documentFragment)
handleDocumentFragment
in interface org.enhydra.xml.dom.DOMTraversal.Handler
DOMTraversal.Handler.handleDocumentFragment(org.w3c.dom.DocumentFragment)
public void handleAttr(org.w3c.dom.Attr attr) throws java.io.IOException
handleAttr
in interface org.enhydra.xml.dom.DOMTraversal.Handler
java.io.IOException
DOMTraversal.Handler.handleAttr(org.w3c.dom.Attr)
protected final void writeOpenTag(org.w3c.dom.Element element, java.lang.String tagName, boolean hasChildren) throws java.io.IOException
java.io.IOException
public void handleElement(org.w3c.dom.Element element) throws java.io.IOException
This optionally corrects problem cases for browsers:
handleElement
in interface org.enhydra.xml.dom.DOMTraversal.Handler
java.io.IOException
DOMTraversal.Handler.handleElement(org.w3c.dom.Element)
public void handleProcessingInstruction(org.w3c.dom.ProcessingInstruction pi) throws java.io.IOException
handleProcessingInstruction
in interface org.enhydra.xml.dom.DOMTraversal.Handler
java.io.IOException
DOMTraversal.Handler.handleProcessingInstruction(org.w3c.dom.ProcessingInstruction)
public void handleCDATASection(org.w3c.dom.CDATASection cdata) throws java.io.IOException
handleCDATASection
in interface org.enhydra.xml.dom.DOMTraversal.Handler
java.io.IOException
DOMTraversal.Handler.handleCDATASection(org.w3c.dom.CDATASection)
public final void handleText(org.w3c.dom.Text text) throws java.io.IOException
handleText
in interface org.enhydra.xml.dom.DOMTraversal.Handler
java.io.IOException
DOMTraversal.Handler.handleText(org.w3c.dom.Text)
public byte[] toBytes(org.w3c.dom.Node document)
toBytes
in interface org.enhydra.util.DOMFormatter
public void write(org.w3c.dom.Node node, java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public static org.enhydra.xml.io.Formatter getFormatter(org.w3c.dom.Node node, org.enhydra.xml.io.OutputOptions outputOptions, boolean forPreFormatting)
public static org.enhydra.xml.io.DocumentInfo findDocumentInfo(org.w3c.dom.Document document)
public final java.lang.String getMIMEEncoding()
getMIMEEncoding
in interface org.enhydra.xml.io.Formatter
Formatter#getMIMEEncoding
public boolean usedPreFormattedText()
usedPreFormattedText
in interface org.enhydra.xml.io.Formatter
Formatter#usedPreFormattedText
public final int getPreFormattedTextCount()
getPreFormattedTextCount
in interface org.enhydra.xml.io.Formatter
public final int getDynamicFormattedTextCount()
getDynamicFormattedTextCount
in interface org.enhydra.xml.io.Formatter
public final boolean usedPreFormattedElements()
usedPreFormattedElements
in interface org.enhydra.xml.io.Formatter
Formatter#usedPreFormattedElements
public final int getPreFormattedElementCount()
getPreFormattedElementCount
in interface org.enhydra.xml.io.Formatter
public final int getDynamicFormattedElementCount()
getDynamicFormattedElementCount
in interface org.enhydra.xml.io.Formatter
protected final void writeln() throws java.io.IOException
java.io.IOException
protected final void printIndent() throws java.io.IOException
java.io.IOException
protected final void writeText(java.lang.String text) throws java.io.IOException
java.io.IOException
public final void handleEntity(org.w3c.dom.Entity entity)
handleEntity
in interface org.enhydra.xml.dom.DOMTraversal.Handler
DOMTraversal.Handler.handleEntity(org.w3c.dom.Entity)
public final void handleNotation(org.w3c.dom.Notation notation)
handleNotation
in interface org.enhydra.xml.dom.DOMTraversal.Handler
DOMTraversal.Handler.handleNotation(org.w3c.dom.Notation)
public final void handleEntityReference(org.w3c.dom.EntityReference entityRef) throws java.io.IOException
handleEntityReference
in interface org.enhydra.xml.dom.DOMTraversal.Handler
java.io.IOException
DOMTraversal.Handler.handleEntityReference(org.w3c.dom.EntityReference)
public final void handleComment(org.w3c.dom.Comment comment) throws java.io.IOException
handleComment
in interface org.enhydra.xml.dom.DOMTraversal.Handler
java.io.IOException
DOMTraversal.Handler.handleComment(org.w3c.dom.Comment)
protected final void writeAttributeValue(org.w3c.dom.Attr attr) throws java.io.IOException
java.io.IOException
public final java.lang.String preFormatNode(org.w3c.dom.Node node)
preFormatNode
in interface org.enhydra.xml.io.Formatter
Formatter#preFormatNode
public final void write(org.w3c.dom.Node node, java.io.Writer writer) throws java.io.IOException
write
in interface org.enhydra.xml.io.Formatter
java.io.IOException
Formatter#write
|
EAF 7.4 Util | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |