org.apache.batik.transcoder.svg2svg
Class OutputManager

java.lang.Object
  |
  +--org.apache.batik.transcoder.svg2svg.OutputManager

public class OutputManager
extends java.lang.Object

This class is responsible of the output of XML constructs.


Inner Class Summary
static class OutputManager.AttributeInfo
          To store the informations about an attribute.
static class OutputManager.NameInfo
          To store the informations about a name.
 
Field Summary
protected  boolean canIndent
          Whether the next markup can be indented.
protected  int column
          The current column.
protected  int level
          The indentation level.
protected  int line
          The current line.
protected  boolean lineAttributes
          Whether the attribute layout must be done on a single line.
protected  java.lang.StringBuffer margin
          The margin.
protected  PrettyPrinter prettyPrinter
          The pretty printer.
protected  java.util.List startingLines
          The elements starting lines.
protected  java.io.Writer writer
          The writer used to output the tokens.
protected  java.util.List xmlSpace
          The xml:space values.
 
Constructor Summary
OutputManager(PrettyPrinter pp, java.io.Writer w)
          Creates a new output manager.
 
Method Summary
protected  void formatText(char[] text, java.lang.String margin)
          Formats the given text.
protected  boolean isWhiteSpace(char[] text)
          Tells whether the given character represents white spaces.
protected  int newlines(char[] text)
          Returns the number of newlines in the given char array.
 void printAttlistEnd(char[] space)
          Prints an attribute list declaration end.
 void printAttlistStart(char[] space, char[] name)
          Prints an attribute list declaration start.
 void printAttName(char[] space1, char[] name, char[] space2)
          Prints an attribute declaration start.
 void printCDATASection(char[] data)
          Prints a CDATA section.
 void printCharacter(char c)
          Prints a single character.
 void printCharacterData(char[] data)
          Prints the character data of an element content.
 void printCharacterEntityReference(char[] code)
          Prints a character entity reference.
 void printCharacters(char[] ca)
          Prints a char array.
 void printComment(char[] text)
          Prints a comment.
 void printDoctypeEnd(char[] space)
          Prints the portion of the doctype after ']'.
 void printDoctypeStart(char[] space1, char[] root, char[] space2, java.lang.String externalId, char[] space3, char[] string1, char string1Delim, char[] space4, char[] string2, char string2Delim, char[] space5)
          Prints the portion of the doctype before '['.
 void printElementEnd(char[] name, char[] space)
          Prints the end of an element.
 void printElementStart(char[] name, java.util.List attributes, char[] space)
          Prints the start of an element.
 void printEntityReference(char[] name)
          Prints an entity reference.
 void printEnumeration(java.util.List names)
          Prints an enumeration.
 void printNewline()
          Prints a newline.
 void printNotation(char[] space1, char[] name, char[] space2, java.lang.String externalId, char[] space3, char[] string1, char string1Delim, char[] space4, char[] string2, char string2Delim, char[] space5)
          Prints a notation declaration.
 void printParameterEntityReference(char[] name)
          Prints a parameter entity reference.
 void printPI(char[] target, char[] space, char[] data)
          Prints a processing instruction.
 void printSpaces(char[] text, boolean opt)
          Prints white spaces.
 void printString(java.lang.String s)
          Prints a string.
 void printTopSpaces(char[] text)
          Prints top level white spaces.
 void printXMLDecl(char[] space1, char[] space2, char[] space3, char[] version, char versionDelim, char[] space4, char[] space5, char[] space6, char[] encoding, char encodingDelim, char[] space7, char[] space8, char[] space9, char[] standalone, char standaloneDelim, char[] space10)
          Prints an XML declaration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

prettyPrinter

protected PrettyPrinter prettyPrinter
The pretty printer.

writer

protected java.io.Writer writer
The writer used to output the tokens.

level

protected int level
The indentation level.

margin

protected java.lang.StringBuffer margin
The margin.

line

protected int line
The current line.

column

protected int column
The current column.

xmlSpace

protected java.util.List xmlSpace
The xml:space values.

canIndent

protected boolean canIndent
Whether the next markup can be indented.

startingLines

protected java.util.List startingLines
The elements starting lines.

lineAttributes

protected boolean lineAttributes
Whether the attribute layout must be done on a single line.
Constructor Detail

OutputManager

public OutputManager(PrettyPrinter pp,
                     java.io.Writer w)
Creates a new output manager.
Parameters:
s - The scanner used for input tokenization.
Method Detail

printCharacter

public void printCharacter(char c)
                    throws java.io.IOException
Prints a single character.

printNewline

public void printNewline()
                  throws java.io.IOException
Prints a newline.

printString

public void printString(java.lang.String s)
                 throws java.io.IOException
Prints a string.

printCharacters

public void printCharacters(char[] ca)
                     throws java.io.IOException
Prints a char array.

printSpaces

public void printSpaces(char[] text,
                        boolean opt)
                 throws java.io.IOException
Prints white spaces.
Parameters:
text - The space text.
opt - whether the space is optional.

printTopSpaces

public void printTopSpaces(char[] text)
                    throws java.io.IOException
Prints top level white spaces.
Parameters:
text - The space text.
opt - whether the space is optional.

printComment

public void printComment(char[] text)
                  throws java.io.IOException
Prints a comment.
Parameters:
text - The comment text.

printXMLDecl

public void printXMLDecl(char[] space1,
                         char[] space2,
                         char[] space3,
                         char[] version,
                         char versionDelim,
                         char[] space4,
                         char[] space5,
                         char[] space6,
                         char[] encoding,
                         char encodingDelim,
                         char[] space7,
                         char[] space8,
                         char[] space9,
                         char[] standalone,
                         char standaloneDelim,
                         char[] space10)
                  throws java.io.IOException
Prints an XML declaration.

printPI

public void printPI(char[] target,
                    char[] space,
                    char[] data)
             throws java.io.IOException
Prints a processing instruction.

printDoctypeStart

public void printDoctypeStart(char[] space1,
                              char[] root,
                              char[] space2,
                              java.lang.String externalId,
                              char[] space3,
                              char[] string1,
                              char string1Delim,
                              char[] space4,
                              char[] string2,
                              char string2Delim,
                              char[] space5)
                       throws java.io.IOException
Prints the portion of the doctype before '['.

printDoctypeEnd

public void printDoctypeEnd(char[] space)
                     throws java.io.IOException
Prints the portion of the doctype after ']'.

printParameterEntityReference

public void printParameterEntityReference(char[] name)
                                   throws java.io.IOException
Prints a parameter entity reference.

printEntityReference

public void printEntityReference(char[] name)
                          throws java.io.IOException
Prints an entity reference.

printCharacterEntityReference

public void printCharacterEntityReference(char[] code)
                                   throws java.io.IOException
Prints a character entity reference.

printElementStart

public void printElementStart(char[] name,
                              java.util.List attributes,
                              char[] space)
                       throws java.io.IOException
Prints the start of an element.

printElementEnd

public void printElementEnd(char[] name,
                            char[] space)
                     throws java.io.IOException
Prints the end of an element.

printCharacterData

public void printCharacterData(char[] data)
                        throws java.io.IOException
Prints the character data of an element content.

printCDATASection

public void printCDATASection(char[] data)
                       throws java.io.IOException
Prints a CDATA section.

printNotation

public void printNotation(char[] space1,
                          char[] name,
                          char[] space2,
                          java.lang.String externalId,
                          char[] space3,
                          char[] string1,
                          char string1Delim,
                          char[] space4,
                          char[] string2,
                          char string2Delim,
                          char[] space5)
                   throws java.io.IOException
Prints a notation declaration.

printAttlistStart

public void printAttlistStart(char[] space,
                              char[] name)
                       throws java.io.IOException
Prints an attribute list declaration start.

printAttlistEnd

public void printAttlistEnd(char[] space)
                     throws java.io.IOException
Prints an attribute list declaration end.

printAttName

public void printAttName(char[] space1,
                         char[] name,
                         char[] space2)
                  throws java.io.IOException
Prints an attribute declaration start.

printEnumeration

public void printEnumeration(java.util.List names)
                      throws java.io.IOException
Prints an enumeration.

newlines

protected int newlines(char[] text)
Returns the number of newlines in the given char array.

isWhiteSpace

protected boolean isWhiteSpace(char[] text)
Tells whether the given character represents white spaces.

formatText

protected void formatText(char[] text,
                          java.lang.String margin)
                   throws java.io.IOException
Formats the given text.


Copyright © 2002 Apache Software Foundation. All Rights Reserved.