|
XML Parser for Java 1.1.9 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.xml.parser.NOOPVisitor | +--com.ibm.xml.parser.ToXMLStringVisitor | +--com.ibm.xml.parser.FormatPrintVisitor
FormatPrintVisitor implements the Visitor interface in the visitor design pattern for the
purpose of supporting TXDocument#printWithFormat
on the various DOM- and
XML4J-defined Nodes.
Formatted printing is defined as:
The following sample code uses the FormatPrintVisitor on a hierarchy of nodes:
Visitor visitor = new FormatPrintVisitor(printWriter, encoding, indent); new NonRecursivePreorderTreeTraversal(visitor).traverse(this);
TXDocument.printWithFormat(java.io.Writer)
,
TXElement.isPreserveSpace()
,
TXText.getIsIgnorableWhitespace()
,
Visitor
,
TreeTraversal
,
NonRecursivePreorderTreeTraversal
,
ToXMLStringVisitor
,
HTMLPrintVisitor
Field Summary | |
protected int |
currentIndent
|
protected int |
indent
|
protected boolean |
ispreserve
|
protected boolean |
isprevtext
|
protected java.util.Stack |
preserves
|
Fields inherited from class com.ibm.xml.parser.ToXMLStringVisitor |
encoding,
isPrintNonSpecifiedAttributes,
writer |
Constructor Summary | |
FormatPrintVisitor(java.io.Writer writer)
Constructor for default encoding. |
|
FormatPrintVisitor(java.io.Writer writer,
java.lang.String encoding)
Constructor for customized encoding. |
|
FormatPrintVisitor(java.io.Writer writer,
java.lang.String encoding,
int indent)
Constructor for customized encoding and indent. |
Method Summary | |
void |
visitAttlistPre(Attlist attlist)
Creates a formatted string representation of the specified attlist Node and any associated AttDefs in XML format, and directs it to the print writer. |
void |
visitCommentPre(TXComment comment)
Creates a formatted string representation of the specified comment Node in XML format, and directs it to the print writer. |
void |
visitDocumentPost(TXDocument document)
Flush the writer. |
void |
visitDTDPost(DTD dtd)
Creates a formatted string representation of the end of the specified dtd Node in XML format, and directs it to the print writer. |
void |
visitDTDPre(DTD dtd)
Creates a formatted string representation of the start of the specified dtd Node in XML format, and directs it to the print writer. |
void |
visitElementDeclPre(ElementDecl elementDecl)
Creates a formatted string representation of the specified elementDecl Node in XML format, and directs it to the print writer. |
void |
visitElementPost(TXElement element)
Creates a formatted string representation of the end of the specified element Node in XML format, and directs it to the print writer. |
void |
visitElementPre(TXElement element)
Creates a formatted string representation of the start of the specified element Node and its associated attributes in XML format, and directs it to the print writer. |
void |
visitEntityDeclPre(EntityDecl entityDecl)
Creates a formatted string representation of the specified entityDecl Node in XML format, and directs it to the print writer. |
void |
visitNotationPre(TXNotation notation)
Creates a formatted string representation of the specified notation Node in XML format, and directs it to the print writer. |
void |
visitPIPre(TXPI pi)
Creates a formatted string representation of the specified pi Node in XML format, and directs it to the print writer. |
void |
visitTextPre(TXText text)
Creates a formatted string representation of the specified text Node in XML format, and directs it to the print writer. |
Methods inherited from class com.ibm.xml.parser.ToXMLStringVisitor |
getPrintNonSpecifiedAttributes,
setPrintNonSpecifiedAttributes,
visitAttDefPre,
visitAttributePre,
visitDocumentPre,
visitGeneralReferencePre,
visitPseudoNodePre |
Methods inherited from class com.ibm.xml.parser.NOOPVisitor |
visitAttDefPost,
visitAttlistPost,
visitAttributePost,
visitCommentPost,
visitDocumentFragmentPost,
visitDocumentFragmentPre,
visitElementDeclPost,
visitEntityDeclPost,
visitGeneralReferencePost,
visitNotationPost,
visitPIPost,
visitPseudoNodePost,
visitTextPost |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected int currentIndent
protected int indent
protected boolean ispreserve
protected java.util.Stack preserves
protected boolean isprevtext
Constructor Detail |
public FormatPrintVisitor(java.io.Writer writer, java.lang.String encoding, int indent)
writer
- The character output stream to use.encoding
- Java character encoding in use by writer.indent
- Number of spaces to indent at each nesting level.public FormatPrintVisitor(java.io.Writer writer, java.lang.String encoding)
writer
- The character output stream to use.encoding
- Java character encoding in use by writer.public FormatPrintVisitor(java.io.Writer writer)
writer
- The character output stream to use.Method Detail |
public void visitDocumentPost(TXDocument document) throws java.lang.Exception
document
- Node to print with format.TXDocument
public void visitElementPre(TXElement element) throws java.lang.Exception
element
- Node to print with format.TXElement
public void visitElementPost(TXElement element) throws java.lang.Exception
element
- Node to print with format.TXElement
public void visitPIPre(TXPI pi) throws java.lang.Exception
pi
- Node to print with format.TXPI
public void visitCommentPre(TXComment comment) throws java.lang.Exception
comment
- Node to print with format.TXComment
public void visitTextPre(TXText text) throws java.lang.Exception
text
- Node to print with format.TXText
public void visitDTDPre(DTD dtd) throws java.lang.Exception
isPrintInternalDTD()
.dtd
- Node to print with format.DTD.isPrintInternalDTD()
,
DTD
public void visitDTDPost(DTD dtd) throws java.lang.Exception
dtd
- Node to print with format.DTD
public void visitElementDeclPre(ElementDecl elementDecl) throws java.lang.Exception
elementDecl
- Node to print with format.ElementDecl
public void visitAttlistPre(Attlist attlist) throws java.lang.Exception
attlist
- Node to print with format.Attlist
public void visitEntityDeclPre(EntityDecl entityDecl) throws java.lang.Exception
entityDecl
- Node to print with format.EntityDecl
public void visitNotationPre(TXNotation notation) throws java.lang.Exception
notation
- Node to print with format.TXNotation
|
XML Parser for Java 1.1.9 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |