Class OutputManager
java.lang.Object
org.apache.batik.transcoder.svg2svg.OutputManager
This class is responsible of the output of XML constructs.
- Version:
- $Id$
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classTo store the informations about an attribute.static classTo store the informations about a name. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanWhether the next markup can be indented.protected intThe current column.protected intThe indentation level.protected intThe current line.protected booleanWhether the attribute layout must be done on a single line.protected StringBufferThe margin.protected PrettyPrinterThe pretty printer.protected ListThe elements starting lines.protected WriterThe writer used to output the tokens.protected ListThe xml:space values. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected 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.voidPrints 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.voidPrints 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 Details
-
prettyPrinter
The pretty printer. -
writer
The writer used to output the tokens. -
level
protected int levelThe indentation level. -
margin
The margin. -
line
protected int lineThe current line. -
column
protected int columnThe current column. -
xmlSpace
The xml:space values. -
canIndent
protected boolean canIndentWhether the next markup can be indented. -
startingLines
The elements starting lines. -
lineAttributes
protected boolean lineAttributesWhether the attribute layout must be done on a single line.
-
-
Constructor Details
-
OutputManager
Creates a new output manager.- Parameters:
pp- The PrettyPrinter used for formatting the output.w- The Writer to write the output to.
-
-
Method Details
-
printCharacter
Prints a single character.- Throws:
IOException
-
printNewline
-
printString
-
printCharacters
-
printSpaces
Prints white spaces.- Parameters:
text- The space text.opt- whether the space is optional.- Throws:
IOException
-
printTopSpaces
Prints top level white spaces.- Parameters:
text- The space text.- Throws:
IOException
-
printComment
Prints a comment.- Parameters:
text- The comment text.- Throws:
IOException
-
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 IOException Prints an XML declaration.- Throws:
IOException
-
printPI
Prints a processing instruction.- Throws:
IOException
-
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) throws IOException Prints the portion of the doctype before '['.- Throws:
IOException
-
printDoctypeEnd
Prints the portion of the doctype after ']'.- Throws:
IOException
-
printParameterEntityReference
Prints a parameter entity reference.- Throws:
IOException
-
printEntityReference
Prints an entity reference.- Throws:
IOException
-
printCharacterEntityReference
public void printCharacterEntityReference(char[] code, boolean first, boolean preceedingSpace) throws IOException Prints a character entity reference.- Throws:
IOException
-
printElementStart
Prints the start of an element.- Throws:
IOException
-
printElementEnd
Prints the end of an element.- Throws:
IOException
-
printCharacterData
public boolean printCharacterData(char[] data, boolean first, boolean preceedingSpace) throws IOException Prints the character data of an element content.- Throws:
IOException
-
printCDATASection
Prints a CDATA section.- Throws:
IOException
-
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) throws IOException Prints a notation declaration.- Throws:
IOException
-
printAttlistStart
Prints an attribute list declaration start.- Throws:
IOException
-
printAttlistEnd
Prints an attribute list declaration end.- Throws:
IOException
-
printAttName
Prints an attribute declaration start.- Throws:
IOException
-
printEnumeration
Prints an enumeration.- Throws:
IOException
-
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 boolean formatText(char[] text, String margin, boolean preceedingSpace) throws IOException Formats the given text.- Throws:
IOException
-