org.apache.batik.transcoder.svg2svg
Class PrettyPrinter

java.lang.Object
  extended by org.apache.batik.transcoder.svg2svg.PrettyPrinter

public class PrettyPrinter
extends Object

This class represents an SVG source files pretty-printer.


Field Summary
static int DOCTYPE_CHANGE
           
static int DOCTYPE_KEEP_UNCHANGED
           
static int DOCTYPE_REMOVE
           
protected  int doctypeOption
          The doctype option.
protected  int documentWidth
          The document width.
protected  ErrorHandler errorHandler
          The error handler.
protected  boolean format
          Whether the output must be formatted.
protected  String newline
          The newline characters.
protected  OutputManager output
          The output manager.
protected  String publicId
          The public id.
protected  XMLScanner scanner
          The document scanner.
protected  String systemId
          The system id.
protected  int tabulationWidth
          The tabulation width.
protected  int type
          The type of the current lexical unit.
protected  Writer writer
          The writer used to output the document.
protected  String xmlDeclaration
          The XML declaration.
 
Constructor Summary
PrettyPrinter()
           
 
Method Summary
protected  TranscoderException fatalError(String key, Object[] params)
          Creates a transcoder exception.
protected  char[] getCurrentValue()
          Returns the current lexical unit value.
 int getDocumentWidth()
          Returns whether the document width.
 boolean getFormat()
          Returns whether the output must be formatted.
 String getNewline()
          Returns the newline characters.
 int getTabulationWidth()
          Returns whether the tabulation width.
 void print(Reader r, Writer w)
          Prints an SVG document from the given reader to the given writer.
protected  void printAttlist()
          Prints an ATTLIST declaration.
protected  void printChildren()
          Prints the children of an element declaration.
protected  void printContent(boolean spaceAtStart)
          Prints the content of an element.
protected  void printDoctype()
          Prints the doctype.
protected  String printElement()
          Prints an element.
protected  void printElementDeclaration()
          Prints an element declaration.
protected  void printEntityDeclaration()
          Prints an entity declaration.
protected  void printNotation()
          Prints a notation declaration.
protected  void printPI()
          Prints a processing instruction.
protected  void printXMLDecl()
          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 setPublicId(String s)
          Sets the public ID.
 void setSystemId(String s)
          Sets the system ID.
 void setTabulationWidth(int i)
          Sets the tabulation width.
 void setXMLDeclaration(String s)
          Sets the XML declaration text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DOCTYPE_CHANGE

public static final int DOCTYPE_CHANGE
See Also:
Constant Field Values

DOCTYPE_REMOVE

public static final int DOCTYPE_REMOVE
See Also:
Constant Field Values

DOCTYPE_KEEP_UNCHANGED

public static final int DOCTYPE_KEEP_UNCHANGED
See Also:
Constant Field Values

scanner

protected XMLScanner scanner
The document scanner.


output

protected OutputManager output
The output manager.


writer

protected Writer writer
The writer used to output the document.


errorHandler

protected ErrorHandler errorHandler
The error handler.


newline

protected String newline
The newline characters.


format

protected boolean format
Whether the output must be formatted.


tabulationWidth

protected int tabulationWidth
The tabulation width.


documentWidth

protected int documentWidth
The document width.


doctypeOption

protected int doctypeOption
The doctype option.


publicId

protected String publicId
The public id.


systemId

protected String systemId
The system id.


xmlDeclaration

protected String xmlDeclaration
The XML declaration.


type

protected int type
The type of the current lexical unit.

Constructor Detail

PrettyPrinter

public PrettyPrinter()
Method Detail

setXMLDeclaration

public void setXMLDeclaration(String s)
Sets the XML declaration text.


setDoctypeOption

public void setDoctypeOption(int i)
Sets the doctype option.


setPublicId

public void setPublicId(String s)
Sets the public ID.


setSystemId

public void setSystemId(String s)
Sets the system ID.


setNewline

public void setNewline(String s)
Sets the newline characters.


getNewline

public String 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

public void print(Reader r,
                  Writer w)
           throws TranscoderException,
                  IOException
Prints an SVG document from the given reader to the given writer.

Throws:
TranscoderException
IOException

printXMLDecl

protected void printXMLDecl()
                     throws TranscoderException,
                            XMLException,
                            IOException
Prints the XML declaration.

Throws:
TranscoderException
XMLException
IOException

printPI

protected void printPI()
                throws TranscoderException,
                       XMLException,
                       IOException
Prints a processing instruction.

Throws:
TranscoderException
XMLException
IOException

printDoctype

protected void printDoctype()
                     throws TranscoderException,
                            XMLException,
                            IOException
Prints the doctype.

Throws:
TranscoderException
XMLException
IOException

printElement

protected String printElement()
                       throws TranscoderException,
                              XMLException,
                              IOException
Prints an element.

Throws:
TranscoderException
XMLException
IOException

printContent

protected void printContent(boolean spaceAtStart)
                     throws TranscoderException,
                            XMLException,
                            IOException
Prints the content of an element.

Throws:
TranscoderException
XMLException
IOException

printNotation

protected void printNotation()
                      throws TranscoderException,
                             XMLException,
                             IOException
Prints a notation declaration.

Throws:
TranscoderException
XMLException
IOException

printAttlist

protected void printAttlist()
                     throws TranscoderException,
                            XMLException,
                            IOException
Prints an ATTLIST declaration.

Throws:
TranscoderException
XMLException
IOException

printEntityDeclaration

protected void printEntityDeclaration()
                               throws TranscoderException,
                                      XMLException,
                                      IOException
Prints an entity declaration.

Throws:
TranscoderException
XMLException
IOException

printElementDeclaration

protected void printElementDeclaration()
                                throws TranscoderException,
                                       XMLException,
                                       IOException
Prints an element declaration.

Throws:
TranscoderException
XMLException
IOException

printChildren

protected void printChildren()
                      throws TranscoderException,
                             XMLException,
                             IOException
Prints the children of an element declaration.

Throws:
TranscoderException
XMLException
IOException

getCurrentValue

protected char[] getCurrentValue()
Returns the current lexical unit value.


fatalError

protected TranscoderException fatalError(String key,
                                         Object[] params)
                                  throws TranscoderException
Creates a transcoder exception.

Throws:
TranscoderException


Copyright © 2008 Apache Software Foundation. All Rights Reserved.