Top Fields Constructors Methods
com.sun.xml.txw2.output

public Class IndentingXMLStreamWriter

extends DelegatingXMLStreamWriter
Class Inheritance
Imports
javax.xml.stream.XMLStreamException, .XMLStreamWriter, java.util.Stack

Author
Kohsuke Kawaguchi

Field Summary

Modifier and TypeField and Description
private int
private String
private static final Object
private static final Object
private static final Object
private Object
private Stack<Object>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
doIndent()

Print indentation for the current level.

public int

Returns:

The number of spaces in each indentation step, or 0 or less for no indentation.
getIndentStep
()
Deprecated Only return the length of the indent string.

Return the current indent step.

private void
private void
private void
public void
setIndentStep(int
The new indent step (0 or less for no indentation).
indentStep
)
Deprecated Should use the version that takes string.

Set the current indent step.

public void
public void
public void
public void
public void
public void
writeEmptyElement(String prefix, String localName, String namespaceURI)

Overrides com.sun.xml.txw2.output.DelegatingXMLStreamWriter.writeEmptyElement.

Implements javax.xml.stream.XMLStreamWriter.writeEmptyElement.

Writes an empty element tag to the output

public void
public void
writeEndElement()

Overrides com.sun.xml.txw2.output.DelegatingXMLStreamWriter.writeEndElement.

Implements javax.xml.stream.XMLStreamWriter.writeEndElement.

Writes an end tag to the output relying on the internal state of the writer to determine the prefix and local name of the event.

public void
public void
public void
public void
public void
public void
Inherited from com.sun.xml.txw2.output.DelegatingXMLStreamWriter:
closeflushgetNamespaceContextgetPrefixgetPropertysetDefaultNamespacesetNamespaceContextsetPrefixwriteAttributewriteAttributewriteAttributewriteCommentwriteDefaultNamespacewriteDTDwriteEndDocumentwriteEntityRefwriteNamespacewriteProcessingInstructionwriteProcessingInstruction

Field Detail

depthback to summary
private int depth
indentStepback to summary
private String indentStep
SEEN_DATAback to summary
private static final Object SEEN_DATA
SEEN_ELEMENTback to summary
private static final Object SEEN_ELEMENT
SEEN_NOTHINGback to summary
private static final Object SEEN_NOTHING
stateback to summary
private Object state
stateStackback to summary
private Stack<Object> stateStack

Constructor Detail

IndentingXMLStreamWriterback to summary
public IndentingXMLStreamWriter(XMLStreamWriter writer)

Method Detail

doIndentback to summary
private void doIndent() throws XMLStreamException

Print indentation for the current level.

Exceptions
XMLStreamException:
If there is an error writing the indentation characters, or if a filter further down the chain raises an exception.
getIndentStepback to summary
public int getIndentStep()

Deprecated

Only return the length of the indent string.

Return the current indent step.

Return the current indent step: each start tag will be indented by this number of spaces times the number of ancestors that the element has.

Returns:int

The number of spaces in each indentation step, or 0 or less for no indentation.

Annotations
@Deprecated
See Also
setIndentStep(int)
onEmptyElementback to summary
private void onEmptyElement() throws XMLStreamException
onEndElementback to summary
private void onEndElement() throws XMLStreamException
onStartElementback to summary
private void onStartElement() throws XMLStreamException
setIndentStepback to summary
public void setIndentStep(int indentStep)

Deprecated

Should use the version that takes string.

Set the current indent step.

Parameters
indentStep:int

The new indent step (0 or less for no indentation).

Annotations
@Deprecated
See Also
getIndentStep()
setIndentStepback to summary
public void setIndentStep(String s)
writeCDataback to summary
public void writeCData(String data) throws XMLStreamException

Overrides com.sun.xml.txw2.output.DelegatingXMLStreamWriter.writeCData.

Implements javax.xml.stream.XMLStreamWriter.writeCData.

Doc from javax.xml.stream.XMLStreamWriter.writeCData.

Writes a CData section

Annotations
@Override
Exceptions
XMLStreamException:
if an error occurs
writeCharactersback to summary
public void writeCharacters(String text) throws XMLStreamException

Overrides com.sun.xml.txw2.output.DelegatingXMLStreamWriter.writeCharacters.

Implements javax.xml.stream.XMLStreamWriter.writeCharacters.

Doc from javax.xml.stream.XMLStreamWriter.writeCharacters.

Write text to the output

Annotations
@Override
Exceptions
XMLStreamException:
if an error occurs
writeCharactersback to summary
public void writeCharacters(char[] text, int start, int len) throws XMLStreamException

Overrides com.sun.xml.txw2.output.DelegatingXMLStreamWriter.writeCharacters.

Implements javax.xml.stream.XMLStreamWriter.writeCharacters.

Doc from javax.xml.stream.XMLStreamWriter.writeCharacters.

Write text to the output

Annotations
@Override
Exceptions
XMLStreamException:
if an error occurs
writeEmptyElementback to summary
public void writeEmptyElement(String namespaceURI, String localName) throws XMLStreamException

Overrides com.sun.xml.txw2.output.DelegatingXMLStreamWriter.writeEmptyElement.

Implements javax.xml.stream.XMLStreamWriter.writeEmptyElement.

Doc from javax.xml.stream.XMLStreamWriter.writeEmptyElement.

Writes an empty element tag to the output

Annotations
@Override
Exceptions
XMLStreamException:
if the namespace URI has not been bound to a prefix and javax.xml.stream.isRepairingNamespaces has not been set to true
writeEmptyElementback to summary
public void writeEmptyElement(String prefix, String localName, String namespaceURI) throws XMLStreamException

Overrides com.sun.xml.txw2.output.DelegatingXMLStreamWriter.writeEmptyElement.

Implements javax.xml.stream.XMLStreamWriter.writeEmptyElement.

Doc from javax.xml.stream.XMLStreamWriter.writeEmptyElement.

Writes an empty element tag to the output

Annotations
@Override
Exceptions
XMLStreamException:
if an error occurs
writeEmptyElementback to summary
public void writeEmptyElement(String localName) throws XMLStreamException

Overrides com.sun.xml.txw2.output.DelegatingXMLStreamWriter.writeEmptyElement.

Implements javax.xml.stream.XMLStreamWriter.writeEmptyElement.

Doc from javax.xml.stream.XMLStreamWriter.writeEmptyElement.

Writes an empty element tag to the output

Annotations
@Override
Exceptions
XMLStreamException:
if an error occurs
writeEndElementback to summary
public void writeEndElement() throws XMLStreamException

Overrides com.sun.xml.txw2.output.DelegatingXMLStreamWriter.writeEndElement.

Implements javax.xml.stream.XMLStreamWriter.writeEndElement.

Doc from javax.xml.stream.XMLStreamWriter.writeEndElement.

Writes an end tag to the output relying on the internal state of the writer to determine the prefix and local name of the event.

Annotations
@Override
Exceptions
XMLStreamException:
if an error occurs
writeStartDocumentback to summary
public void writeStartDocument() throws XMLStreamException

Overrides com.sun.xml.txw2.output.DelegatingXMLStreamWriter.writeStartDocument.

Implements javax.xml.stream.XMLStreamWriter.writeStartDocument.

Doc from javax.xml.stream.XMLStreamWriter.writeStartDocument.

Write the XML Declaration. Defaults the XML version to 1.0, and the encoding to utf-8

Annotations
@Override
Exceptions
XMLStreamException:
if an error occurs
writeStartDocumentback to summary
public void writeStartDocument(String version) throws XMLStreamException

Overrides com.sun.xml.txw2.output.DelegatingXMLStreamWriter.writeStartDocument.

Implements javax.xml.stream.XMLStreamWriter.writeStartDocument.

Doc from javax.xml.stream.XMLStreamWriter.writeStartDocument.

Write the XML Declaration. Defaults the XML version to 1.0

Annotations
@Override
Exceptions
XMLStreamException:
if an error occurs
writeStartDocumentback to summary
public void writeStartDocument(String encoding, String version) throws XMLStreamException

Overrides com.sun.xml.txw2.output.DelegatingXMLStreamWriter.writeStartDocument.

Implements javax.xml.stream.XMLStreamWriter.writeStartDocument.

Doc from javax.xml.stream.XMLStreamWriter.writeStartDocument.

Write the XML Declaration. Note that the encoding parameter does not set the actual encoding of the underlying output. That must be set when the instance of the XMLStreamWriter is created using the XMLOutputFactory

Annotations
@Override
Exceptions
XMLStreamException:
If given encoding does not match encoding of the underlying stream
writeStartElementback to summary
public void writeStartElement(String localName) throws XMLStreamException

Overrides com.sun.xml.txw2.output.DelegatingXMLStreamWriter.writeStartElement.

Implements javax.xml.stream.XMLStreamWriter.writeStartElement.

Doc from javax.xml.stream.XMLStreamWriter.writeStartElement.

Writes a start tag to the output. All writeStartElement methods open a new scope in the internal namespace context. Writing the corresponding EndElement causes the scope to be closed.

Annotations
@Override
Exceptions
XMLStreamException:
if an error occurs
writeStartElementback to summary
public void writeStartElement(String namespaceURI, String localName) throws XMLStreamException

Overrides com.sun.xml.txw2.output.DelegatingXMLStreamWriter.writeStartElement.

Implements javax.xml.stream.XMLStreamWriter.writeStartElement.

Doc from javax.xml.stream.XMLStreamWriter.writeStartElement.

Writes a start tag to the output

Annotations
@Override
Exceptions
XMLStreamException:
if the namespace URI has not been bound to a prefix and javax.xml.stream.isRepairingNamespaces has not been set to true
writeStartElementback to summary
public void writeStartElement(String prefix, String localName, String namespaceURI) throws XMLStreamException

Overrides com.sun.xml.txw2.output.DelegatingXMLStreamWriter.writeStartElement.

Implements javax.xml.stream.XMLStreamWriter.writeStartElement.

Doc from javax.xml.stream.XMLStreamWriter.writeStartElement.

Writes a start tag to the output

Annotations
@Override
Exceptions
XMLStreamException:
if an error occurs