public class

IndentPrinter

extends Printer
java.lang.Object
   ↳ org.apache.xml.serialize.Printer
     ↳ org.apache.xml.serialize.IndentPrinter

This class is deprecated.
This class was deprecated in Xerces 2.9.0. It is recommended that new applications use the DOM Level 3 LSSerializer or JAXP's Transformation API for XML (TrAX) for serializing XML. See the Xerces documentation for more information.

Class Overview

Extends Printer and adds support for indentation and line wrapping.

Summary

[Expand]
Inherited Fields
From class org.apache.xml.serialize.Printer
Public Constructors
IndentPrinter(Writer writer, OutputFormat format)
Public Methods
void breakLine()
Called to print a line consisting of the text accumulated so far.
void breakLine(boolean preserveSpace)
void enterDTD()
Called by any of the DTD handlers to enter DTD mode.
void flush()
Flush the output stream.
void flushLine(boolean preserveSpace)
Flushes the line accumulated so far to the writer and get ready to accumulate the next line.
int getNextIndent()
void indent()
Increment the indentation for the next line.
String leaveDTD()
Called by the root element to leave DTD mode and if any DTD parts were printer, will return a string with their textual content.
void printSpace()
Called to print a single space between text parts that may be broken into separate lines.
void printText(char ch)
void printText(StringBuffer text)
void printText(char[] chars, int start, int length)
void printText(String text)
Called to print additional text.
void setNextIndent(int indent)
void setThisIndent(int indent)
void unindent()
Decrement the indentation for the next line.
[Expand]
Inherited Methods
From class org.apache.xml.serialize.Printer
From class java.lang.Object

Public Constructors

public IndentPrinter (Writer writer, OutputFormat format)

Public Methods

public void breakLine ()

Called to print a line consisting of the text accumulated so far. This is equivalent to calling printSpace() but forcing the line to print and starting a new line (printSpace() will only start a new line if the current line is long enough).

public void breakLine (boolean preserveSpace)

public void enterDTD ()

Called by any of the DTD handlers to enter DTD mode. Once entered, all output will be accumulated in a string that can be printed as part of the document's DTD. This method may be called any number of time but will only have affect the first time it's called. To exist DTD state and get the accumulated DTD, call leaveDTD().

public void flush ()

Flush the output stream. Must be called when done printing the document, otherwise some text might be buffered.

public void flushLine (boolean preserveSpace)

Flushes the line accumulated so far to the writer and get ready to accumulate the next line. This method is called by printText(char) and printSpace() when the accumulated line plus accumulated text are two long to fit on a given line. At the end of this method _line is empty and _spaces is zero.

public int getNextIndent ()

public void indent ()

Increment the indentation for the next line.

public String leaveDTD ()

Called by the root element to leave DTD mode and if any DTD parts were printer, will return a string with their textual content.

public void printSpace ()

Called to print a single space between text parts that may be broken into separate lines. Must not be called to print a space when preserving spaces. The text accumulated so far with printText(char) will be added to the accumulated line, and a space separator will be counted. If the line accumulated so far is long enough, it will be printed.

public void printText (char ch)

public void printText (StringBuffer text)

public void printText (char[] chars, int start, int length)

public void printText (String text)

Called to print additional text. Each time this method is called it accumulates more text. When a space is printed (printSpace()) all the accumulated text becomes one part and is added to the accumulate line. When a line is long enough, it can be broken at its text boundary.

Parameters
text The text to print

public void setNextIndent (int indent)

public void setThisIndent (int indent)

public void unindent ()

Decrement the indentation for the next line.