org.apache.batik.transcoder.svg2svg

Class OutputManager

public class OutputManager extends Object

This class is responsible of the output of XML constructs.
Nested Class Summary
static classOutputManager.AttributeInfo
To store the informations about an attribute.
static classOutputManager.NameInfo
To store the informations about a name.
Field Summary
protected booleancanIndent
Whether the next markup can be indented.
protected intcolumn
The current column.
protected intlevel
The indentation level.
protected intline
The current line.
protected booleanlineAttributes
Whether the attribute layout must be done on a single line.
protected StringBuffermargin
The margin.
protected PrettyPrinterprettyPrinter
The pretty printer.
protected ListstartingLines
The elements starting lines.
protected Writerwriter
The writer used to output the tokens.
protected ListxmlSpace
The xml:space values.
Constructor Summary
OutputManager(PrettyPrinter pp, Writer w)
Creates a new output manager.
Method Summary
protected booleanformatText(char[] text, String margin, boolean preceedingSpace)
Formats the given text.
protected booleanisWhiteSpace(char[] text)
Tells whether the given character represents white spaces.
protected intnewlines(char[] text)
Returns the number of newlines in the given char array.
voidprintAttlistEnd(char[] space)
Prints an attribute list declaration end.
voidprintAttlistStart(char[] space, char[] name)
Prints an attribute list declaration start.
voidprintAttName(char[] space1, char[] name, char[] space2)
Prints an attribute declaration start.
voidprintCDATASection(char[] data)
Prints a CDATA section.
voidprintCharacter(char c)
Prints a single character.
booleanprintCharacterData(char[] data, boolean first, boolean preceedingSpace)
Prints the character data of an element content.
voidprintCharacterEntityReference(char[] code, boolean first, boolean preceedingSpace)
Prints a character entity reference.
voidprintCharacters(char[] ca)
Prints a char array.
voidprintComment(char[] text)
Prints a comment.
voidprintDoctypeEnd(char[] space)
Prints the portion of the doctype after ']'.
voidprintDoctypeStart(char[] space1, char[] root, char[] space2, String externalId, char[] space3, char[] string1, char string1Delim, char[] space4, char[] string2, char string2Delim, char[] space5)
Prints the portion of the doctype before '['.
voidprintElementEnd(char[] name, char[] space)
Prints the end of an element.
voidprintElementStart(char[] name, List attributes, char[] space)
Prints the start of an element.
voidprintEntityReference(char[] name, boolean first)
Prints an entity reference.
voidprintEnumeration(List names)
Prints an enumeration.
voidprintNewline()
Prints a newline.
voidprintNotation(char[] space1, char[] name, char[] space2, String externalId, char[] space3, char[] string1, char string1Delim, char[] space4, char[] string2, char string2Delim, char[] space5)
Prints a notation declaration.
voidprintParameterEntityReference(char[] name)
Prints a parameter entity reference.
voidprintPI(char[] target, char[] space, char[] data)
Prints a processing instruction.
voidprintSpaces(char[] text, boolean opt)
Prints white spaces.
voidprintString(String s)
Prints a string.
voidprintTopSpaces(char[] text)
Prints top level white spaces.
voidprintXMLDecl(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.

Field Detail

canIndent

protected boolean canIndent
Whether the next markup can be indented.

column

protected int column
The current column.

level

protected int level
The indentation level.

line

protected int line
The current line.

lineAttributes

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

margin

protected StringBuffer margin
The margin.

prettyPrinter

protected PrettyPrinter prettyPrinter
The pretty printer.

startingLines

protected List startingLines
The elements starting lines.

writer

protected Writer writer
The writer used to output the tokens.

xmlSpace

protected List xmlSpace
The xml:space values.

Constructor Detail

OutputManager

public OutputManager(PrettyPrinter pp, Writer w)
Creates a new output manager.

Parameters: pp The PrettyPrinter used for formatting the output. w The Writer to write the output to.

Method Detail

formatText

protected boolean formatText(char[] text, String margin, boolean preceedingSpace)
Formats the given text.

isWhiteSpace

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

newlines

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

printAttlistEnd

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

printAttlistStart

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

printAttName

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

printCDATASection

public void printCDATASection(char[] data)
Prints a CDATA section.

printCharacter

public void printCharacter(char c)
Prints a single character.

printCharacterData

public boolean printCharacterData(char[] data, boolean first, boolean preceedingSpace)
Prints the character data of an element content.

printCharacterEntityReference

public void printCharacterEntityReference(char[] code, boolean first, boolean preceedingSpace)
Prints a character entity reference.

printCharacters

public void printCharacters(char[] ca)
Prints a char array.

printComment

public void printComment(char[] text)
Prints a comment.

Parameters: text The comment text.

printDoctypeEnd

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

printDoctypeStart

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

printElementEnd

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

printElementStart

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

printEntityReference

public void printEntityReference(char[] name, boolean first)
Prints an entity reference.

printEnumeration

public void printEnumeration(List names)
Prints an enumeration.

printNewline

public void printNewline()
Prints a newline.

printNotation

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

printParameterEntityReference

public void printParameterEntityReference(char[] name)
Prints a parameter entity reference.

printPI

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

printSpaces

public void printSpaces(char[] text, boolean opt)
Prints white spaces.

Parameters: text The space text. opt whether the space is optional.

printString

public void printString(String s)
Prints a string.

printTopSpaces

public void printTopSpaces(char[] text)
Prints top level white spaces.

Parameters: text The space 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)
Prints an XML declaration.
Copyright B) 2007 Apache Software Foundation. All Rights Reserved.