Class IndentingUTF8XmlOutput
java.lang.Object
com.sun.xml.bind.v2.runtime.output.XmlOutputAbstractImpl
com.sun.xml.bind.v2.runtime.output.UTF8XmlOutput
com.sun.xml.bind.v2.runtime.output.IndentingUTF8XmlOutput
- All Implemented Interfaces:
XmlOutput
UTF8XmlOutput
with indentation.
TODO: not sure if it's a good idea to move the indenting functionality to another class.
Doesn't have to be final, but it helps the JVM.- Author:
- Kohsuke Kawaguchi
-
Field Summary
Fields inherited from class com.sun.xml.bind.v2.runtime.output.UTF8XmlOutput
closeStartTagPending, octetBuffer, octetBufferIndex, out
Fields inherited from class com.sun.xml.bind.v2.runtime.output.XmlOutputAbstractImpl
nsContext, nsUriIndex2prefixIndex, serializer
-
Constructor Summary
ConstructorDescriptionIndentingUTF8XmlOutput
(OutputStream out, String indentStr, Encoded[] localNames, CharacterEscapeHandler escapeHandler) -
Method Summary
Modifier and TypeMethodDescriptionvoid
beginStartTag
(int prefix, String localName) void
beginStartTag
(Name name) Writes a start tag.void
endDocument
(boolean fragment) Called at the very end.void
void
void
Writes XML text with character escaping, if necessary.void
Writes XML text with character escaping, if necessary.Methods inherited from class com.sun.xml.bind.v2.runtime.output.UTF8XmlOutput
attribute, attribute, closeStartTag, endStartTag, flushBuffer, setHeader, startDocument, text, text, write, write, write, writeNsDecl, writeNsDecls
-
Constructor Details
-
IndentingUTF8XmlOutput
public IndentingUTF8XmlOutput(OutputStream out, String indentStr, Encoded[] localNames, CharacterEscapeHandler escapeHandler) - Parameters:
indentStr
- set to null for no indentation and optimal performance. otherwise the string is used for indentation.
-
-
Method Details
-
beginStartTag
- Specified by:
beginStartTag
in interfaceXmlOutput
- Overrides:
beginStartTag
in classUTF8XmlOutput
- Throws:
IOException
-
beginStartTag
Description copied from class:XmlOutputAbstractImpl
Writes a start tag.At this point
XmlOutputAbstractImpl.nsContext
holds namespace declarations needed for this new element.This method is used for writing tags that are indexed.
- Specified by:
beginStartTag
in interfaceXmlOutput
- Overrides:
beginStartTag
in classUTF8XmlOutput
- Throws:
IOException
-
endTag
- Specified by:
endTag
in interfaceXmlOutput
- Overrides:
endTag
in classUTF8XmlOutput
- Throws:
IOException
-
endTag
- Specified by:
endTag
in interfaceXmlOutput
- Overrides:
endTag
in classUTF8XmlOutput
- Throws:
IOException
-
text
Description copied from interface:XmlOutput
Writes XML text with character escaping, if necessary.- Specified by:
text
in interfaceXmlOutput
- Overrides:
text
in classUTF8XmlOutput
- Parameters:
value
- this string can contain characters that might need escaping (such as'&' or '>'
)- Throws:
IOException
-
text
Description copied from interface:XmlOutput
Writes XML text with character escaping, if necessary.- Specified by:
text
in interfaceXmlOutput
- Overrides:
text
in classUTF8XmlOutput
- Parameters:
value
- this string can contain characters that might need escaping (such as'&' or '>'
)- Throws:
IOException
-
endDocument
Description copied from class:XmlOutputAbstractImpl
Called at the very end.- Specified by:
endDocument
in interfaceXmlOutput
- Overrides:
endDocument
in classUTF8XmlOutput
- Parameters:
fragment
- false if we are writing the whole document.- Throws:
IOException
SAXException
XMLStreamException
-