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 intstatic final intstatic final intprotected intThe doctype option.protected intThe document width.protected ErrorHandlerThe error handler.protected booleanWhether the output must be formatted.protected StringThe newline characters.protected OutputManagerThe output manager.protected StringThe public id.protected XMLScannerThe document scanner.protected StringThe system id.protected intThe tabulation width.protected intThe type of the current lexical unit.protected WriterThe writer used to output the document.protected StringThe XML declaration. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected TranscoderExceptionfatalError(String key, Object[] params) Creates a transcoder exception.protected char[]Returns the current lexical unit value.intReturns whether the document width.booleanReturns whether the output must be formatted.Returns the newline characters.intReturns whether the tabulation width.voidPrints an SVG document from the given reader to the given writer.protected voidPrints an ATTLIST declaration.protected voidPrints the children of an element declaration.protected voidprintContent(boolean spaceAtStart) Prints the content of an element.protected voidPrints the doctype.protected StringPrints an element.protected voidPrints an element declaration.protected voidPrints an entity declaration.protected voidPrints a notation declaration.protected voidprintPI()Prints a processing instruction.protected voidPrints the XML declaration.voidsetDoctypeOption(int i) Sets the doctype option.voidsetDocumentWidth(int i) Sets the document width.voidsetFormat(boolean b) Sets the format attribute.voidsetNewline(String s) Sets the newline characters.voidSets the public ID.voidSets the system ID.voidsetTabulationWidth(int i) Sets the tabulation width.voidSets 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:
TranscoderExceptionIOException
-
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
-