|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.quiotix.html.parser.HtmlVisitor
com.quiotix.html.parser.HtmlFormatter
public class HtmlFormatter
HtmlFormatter is a Visitor which traverses an HtmlDocument, dumping the contents of the document to a specified output stream. It assumes that the documents has been preprocessed by HtmlCollector (which matches up beginning and end tags) and by HtmlScrubber (which formats tags in a consistent way). In particular, HtmlScrubber should be invoked with the TRIM_SPACES option to remove trailing spaces, which can confuse the formatting algorithm.
The right margin and indent increment can be specified as properties.
HtmlVisitor,
HtmlCollector,
HtmlScrubber| Field Summary | |
|---|---|
protected com.quiotix.html.parser.TagBlockRenderer |
blockRenderer
|
protected int |
indentSize
|
protected boolean |
inPreBlock
|
protected com.quiotix.html.parser.MarginWriter |
out
|
protected HtmlDocument.HtmlElement |
previousElement
|
protected int |
rightMargin
|
protected static java.util.Set |
tagsIndentBlock
|
protected static java.lang.String[] |
tagsIndentStrings
|
protected static java.util.Set |
tagsNewlineBefore
|
protected static java.lang.String[] |
tagsNewlineBeforeStrings
|
protected static java.util.Set |
tagsPreformatted
|
protected static java.lang.String[] |
tagsPreformattedStrings
|
protected static java.util.Set |
tagsTryMatch
|
protected static java.lang.String[] |
tagsTryMatchStrings
|
| Constructor Summary | |
|---|---|
HtmlFormatter(java.io.OutputStream os)
Constructor. |
|
| Method Summary | |
|---|---|
void |
finish()
Finish. |
static void |
main(java.lang.String[] args)
Runnable. |
void |
setIndent(int indent)
|
void |
setRightMargin(int margin)
|
void |
start()
Start. |
void |
visit(HtmlDocument.Comment c)
Visit a Comment. |
void |
visit(HtmlDocument.EndTag t)
Visit an EndTag. |
void |
visit(HtmlDocument.Newline n)
Visit a Newline. |
void |
visit(HtmlDocument.Tag t)
Visit a Tag. |
void |
visit(HtmlDocument.TagBlock block)
Visit a TagBlock. |
void |
visit(HtmlDocument.Text t)
Visit Text. |
| Methods inherited from class com.quiotix.html.parser.HtmlVisitor |
|---|
visit, visit, visit |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected com.quiotix.html.parser.MarginWriter out
protected int rightMargin
protected int indentSize
protected static java.util.Set tagsIndentBlock
protected static java.util.Set tagsNewlineBefore
protected static java.util.Set tagsPreformatted
protected static java.util.Set tagsTryMatch
protected static final java.lang.String[] tagsIndentStrings
protected static final java.lang.String[] tagsNewlineBeforeStrings
protected static final java.lang.String[] tagsPreformattedStrings
protected static final java.lang.String[] tagsTryMatchStrings
protected com.quiotix.html.parser.TagBlockRenderer blockRenderer
protected HtmlDocument.HtmlElement previousElement
protected boolean inPreBlock
| Constructor Detail |
|---|
public HtmlFormatter(java.io.OutputStream os)
throws java.lang.Exception
java.lang.Exception| Method Detail |
|---|
public void setRightMargin(int margin)
margin - the right margin column to wrap atpublic void setIndent(int indent)
indent - the number of spaces to indent bypublic void visit(HtmlDocument.TagBlock block)
HtmlVisitor
visit in class HtmlVisitorpublic void visit(HtmlDocument.Tag t)
HtmlVisitor
visit in class HtmlVisitorpublic void visit(HtmlDocument.EndTag t)
HtmlVisitor
visit in class HtmlVisitorpublic void visit(HtmlDocument.Comment c)
HtmlVisitor
visit in class HtmlVisitorpublic void visit(HtmlDocument.Text t)
HtmlVisitor
visit in class HtmlVisitorpublic void visit(HtmlDocument.Newline n)
HtmlVisitor
visit in class HtmlVisitorpublic void start()
HtmlVisitor
start in class HtmlVisitorpublic void finish()
HtmlVisitor
finish in class HtmlVisitor
public static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||