|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.enhydra.xml.io.BaseDOMFormatter
Base class with common functionally XML and HTML DOM formatting functionality.
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 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 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. |
Constructor Summary | |
protected |
BaseDOMFormatter(org.w3c.dom.Node node,
OutputOptions outputOptions,
boolean forPreFormatting,
java.lang.String defaultEncoding,
boolean[] entityQuickCheck)
Constructor. |
Method Summary | |
protected abstract 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. |
java.lang.String |
getMIMEEncoding()
Get the MIME-preferred encoding, determined from the OutputOptions and the formatter type. |
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 |
handleComment(org.w3c.dom.Comment comment)
Handler called for Comment 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 |
handleText(org.w3c.dom.Text text)
Handler called for Text nodes. |
java.lang.String |
preFormatNode(org.w3c.dom.Node node)
Format the contents of a node that can later be returned by a node implementing FormattedText. |
protected void |
printIndent()
Print indentation to the current level. |
boolean |
usedPreFormattedElements()
Determine if preformatted element open tags were used for the last document formatted. |
boolean |
usedPreFormattedText()
Determine if preformatted text was used for the last document formatted. |
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 abstract void |
writeOpenTag(org.w3c.dom.Element element,
java.lang.String tagName,
boolean hasChildren)
Method to write an open tag, including attributes. |
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 |
Methods inherited from interface org.enhydra.xml.dom.DOMTraversal.Handler |
handleAttr, handleCDATASection, handleDocument, handleDocumentFragment, handleDocumentType, handleElement, handleProcessingInstruction |
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 OutputOptions fOptions
protected java.io.Writer fOut
protected final 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 |
protected BaseDOMFormatter(org.w3c.dom.Node node, OutputOptions outputOptions, boolean forPreFormatting, java.lang.String defaultEncoding, boolean[] entityQuickCheck)
node
- Any node of the document that this formatter will be
associated with. This can also be an XMLC Document object (XMLObject).defaultEncoding
- The default encoding for this format.forPreFormatting
- Is this going to be used for preformatting?entityQuickCheck
- Document-type specific table that provides
a quick check of the need to encode that character as a character
entity reference. This table MUST include the double-quote character,
as it it used to quote attribute values.Method Detail |
public final java.lang.String getMIMEEncoding()
Formatter
getMIMEEncoding
in interface Formatter
Formatter#getEncoding
public boolean usedPreFormattedText()
Formatter
usedPreFormattedText
in interface Formatter
Formatter.usedPreFormattedText()
public final int getPreFormattedTextCount()
getPreFormattedTextCount
in interface Formatter
public final int getDynamicFormattedTextCount()
getDynamicFormattedTextCount
in interface Formatter
public final boolean usedPreFormattedElements()
Formatter
usedPreFormattedElements
in interface Formatter
Formatter.usedPreFormattedElements()
public final int getPreFormattedElementCount()
getPreFormattedElementCount
in interface Formatter
public final int getDynamicFormattedElementCount()
getDynamicFormattedElementCount
in interface Formatter
protected final void writeln() throws java.io.IOException
java.io.IOException
protected final void printIndent() throws java.io.IOException
java.io.IOException
protected abstract java.lang.String getCharacterEntity(char textChar)
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 DOMTraversal.Handler
DOMTraversal.Handler#handleEntity
public final void handleNotation(org.w3c.dom.Notation notation)
handleNotation
in interface DOMTraversal.Handler
DOMTraversal.Handler#handleNotation
public final void handleEntityReference(org.w3c.dom.EntityReference entityRef) throws java.io.IOException
handleEntityReference
in interface DOMTraversal.Handler
java.io.IOException
DOMTraversal.Handler#handleEntityReference
public final void handleComment(org.w3c.dom.Comment comment) throws java.io.IOException
handleComment
in interface DOMTraversal.Handler
java.io.IOException
DOMTraversal.Handler#handleComment
public void handleText(org.w3c.dom.Text text) throws java.io.IOException
handleText
in interface DOMTraversal.Handler
java.io.IOException
DOMTraversal.Handler#handleText
protected final void writeAttributeValue(org.w3c.dom.Attr attr) throws java.io.IOException
java.io.IOException
protected abstract void writeOpenTag(org.w3c.dom.Element element, java.lang.String tagName, boolean hasChildren) throws java.io.IOException
java.io.IOException
public final java.lang.String preFormatNode(org.w3c.dom.Node node)
Formatter
preFormatNode
in interface Formatter
Formatter.preFormatNode
public final void write(org.w3c.dom.Node node, java.io.Writer writer) throws java.io.IOException
write
in interface Formatter
java.io.IOException
Formatter.write(org.w3c.dom.Node, java.io.Writer)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |