Class PrettyPrinter
java.lang.Object
org.apache.batik.transcoder.svg2svg.PrettyPrinter
This class represents an SVG source files pretty-printer.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
protected int
The doctype option.protected int
The document width.protected ErrorHandler
The error handler.protected boolean
Whether the output must be formatted.protected String
The newline characters.protected OutputManager
The output manager.protected String
The public id.protected XMLScanner
The document scanner.protected String
The system id.protected int
The tabulation width.protected int
The type of the current lexical unit.protected Writer
The writer used to output the document.protected String
The XML declaration. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected TranscoderException
fatalError
(String key, Object[] params) Creates a transcoder exception.protected char[]
Returns the current lexical unit value.int
Returns whether the document width.boolean
Returns whether the output must be formatted.Returns the newline characters.int
Returns whether the tabulation width.void
Prints an SVG document from the given reader to the given writer.protected void
Prints an ATTLIST declaration.protected void
Prints the children of an element declaration.protected void
printContent
(boolean spaceAtStart) Prints the content of an element.protected void
Prints the doctype.protected String
Prints an element.protected void
Prints an element declaration.protected void
Prints an entity declaration.protected void
Prints a notation declaration.protected void
printPI()
Prints a processing instruction.protected void
Prints the XML declaration.void
setDoctypeOption
(int i) Sets the doctype option.void
setDocumentWidth
(int i) Sets the document width.void
setFormat
(boolean b) Sets the format attribute.void
setNewline
(String s) Sets the newline characters.void
Sets the public ID.void
Sets the system ID.void
setTabulationWidth
(int i) Sets the tabulation width.void
Sets the XML declaration text.
-
Field Details
-
DOCTYPE_CHANGE
public static final int DOCTYPE_CHANGE- See Also:
-
DOCTYPE_REMOVE
public static final int DOCTYPE_REMOVE- See Also:
-
DOCTYPE_KEEP_UNCHANGED
public static final int DOCTYPE_KEEP_UNCHANGED- See Also:
-
scanner
The document scanner. -
output
The output manager. -
writer
The writer used to output the document. -
errorHandler
The error handler. -
newline
The newline characters. -
format
protected boolean formatWhether the output must be formatted. -
tabulationWidth
protected int tabulationWidthThe tabulation width. -
documentWidth
protected int documentWidthThe document width. -
doctypeOption
protected int doctypeOptionThe doctype option. -
publicId
The public id. -
systemId
The system id. -
xmlDeclaration
The XML declaration. -
type
protected int typeThe type of the current lexical unit.
-
-
Constructor Details
-
PrettyPrinter
public PrettyPrinter()
-
-
Method Details
-
setXMLDeclaration
Sets the XML declaration text. -
setDoctypeOption
public void setDoctypeOption(int i) Sets the doctype option. -
setPublicId
Sets the public ID. -
setSystemId
Sets the system ID. -
setNewline
Sets the newline characters. -
getNewline
Returns the newline characters. -
setFormat
public void setFormat(boolean b) Sets the format attribute. -
getFormat
public boolean getFormat()Returns whether the output must be formatted. -
setTabulationWidth
public void setTabulationWidth(int i) Sets the tabulation width. -
getTabulationWidth
public int getTabulationWidth()Returns whether the tabulation width. -
setDocumentWidth
public void setDocumentWidth(int i) Sets the document width. -
getDocumentWidth
public int getDocumentWidth()Returns whether the document width. -
print
Prints an SVG document from the given reader to the given writer.- Throws:
TranscoderException
IOException
-
printXMLDecl
Prints the XML declaration. -
printPI
Prints a processing instruction. -
printDoctype
Prints the doctype. -
printElement
Prints an element. -
printContent
protected void printContent(boolean spaceAtStart) throws TranscoderException, XMLException, IOException Prints the content of an element. -
printNotation
Prints a notation declaration. -
printAttlist
Prints an ATTLIST declaration. -
printEntityDeclaration
Prints an entity declaration. -
printElementDeclaration
Prints an element declaration. -
printChildren
Prints the children of an element declaration. -
getCurrentValue
protected char[] getCurrentValue()Returns the current lexical unit value. -
fatalError
Creates a transcoder exception.- Throws:
TranscoderException
-