Top Description Fields Constructors Methods
com.thoughtworks.xstream.io.xml

public Class StaxWriter

extends AbstractXmlWriter
Class Inheritance
Known Direct Subclasses
com.thoughtworks.xstream.io.json.JettisonStaxWriter
Imports
com.thoughtworks.xstream.io.StreamException, com.thoughtworks.xstream.io.naming.NameCoder, javax.xml.namespace.QName, javax.xml.stream.XMLStreamException, .XMLStreamWriter

Deprecated

as a consequence of AbstractXmlWriter being deprecated. See corresponding docs for further information.

A stream writing that outputs to a StAX stream writer
Author
James Strachan
Version
$Revision$

Field Summary

Modifier and TypeField and Description
private boolean
private final XMLStreamWriter
private final QNameMap
private int
private final boolean

Constructor Summary

AccessConstructor and Description
public
public
StaxWriter(QNameMap
is the mapper of Java class names to QNames
qnameMap
,
XMLStreamWriter
the stream to output to
out
,
NameCoder
the xml-friendly replacer to escape Java names
nameCoder
)

Allows a StaxWriter to be created for partial XML output

public
StaxWriter(QNameMap
is the mapper of Java class names to QNames
qnameMap
,
XMLStreamWriter
the stream to output to
out
,
boolean
a flag to indicate whether or not the start/end document events should be written
writeEnclosingDocument
,
boolean
a flag to enable StAX' namespace repairing mode
namespaceRepairingMode
,
NameCoder
the xml-friendly replacer to escape Java names
nameCoder
)

Allows a StaxWriter to be created for partial XML output

public
StaxWriter(QNameMap
is the mapper of Java class names to QNames
qnameMap
,
XMLStreamWriter
the stream to output to
out
,
boolean
a flag to indicate whether or not the start/end document events should be written
writeEnclosingDocument
,
boolean namespaceRepairingMode)

Allows a StaxWriter to be created for partial XML output

public
StaxWriter(QNameMap
is the mapper of Java class names to QNames
qnameMap
,
XMLStreamWriter
the stream to output to
out
,
boolean
a flag to indicate whether or not the start/end document events should be written
writeEnclosingDocument
,
boolean namespaceRepairingMode, XmlFriendlyReplacer
the xml-friendly replacer to escape Java names
replacer
)

Allows a StaxWriter to be created for partial XML output

Method Summary

Modifier and TypeMethod and Description
public void
public void
close()

Implements com.thoughtworks.xstream.io.HierarchicalStreamWriter.close.

Call this method when you're finished with me
public void
public void
flush()

Implements com.thoughtworks.xstream.io.HierarchicalStreamWriter.flush.

Flush the writer, if necessary.
protected QNameMap
protected XMLStreamWriter
public boolean
isNamespaceRepairingMode()

Is StAX namespace repairing mode on or off?

public void
setValue(String text)

Implements com.thoughtworks.xstream.io.HierarchicalStreamWriter.setValue.

Write the value (text content) of the current node.
public void
Inherited from com.thoughtworks.xstream.io.xml.AbstractXmlWriter:
escapeXmlName

Field Detail

namespaceRepairingModeback to summary
private boolean namespaceRepairingMode
outback to summary
private final XMLStreamWriter out
qnameMapback to summary
private final QNameMap qnameMap
tagDepthback to summary
private int tagDepth
writeEnclosingDocumentback to summary
private final boolean writeEnclosingDocument

Constructor Detail

StaxWriterback to summary
public StaxWriter(QNameMap qnameMap, XMLStreamWriter out) throws XMLStreamException
StaxWriterback to summary
public StaxWriter(QNameMap qnameMap, XMLStreamWriter out, NameCoder nameCoder) throws XMLStreamException

Allows a StaxWriter to be created for partial XML output

Parameters
qnameMap:QNameMap

is the mapper of Java class names to QNames

out:XMLStreamWriter

the stream to output to

nameCoder:NameCoder

the xml-friendly replacer to escape Java names

Exceptions
XMLStreamException:
if the events could not be written to the output
Since
1.4
StaxWriterback to summary
public StaxWriter(QNameMap qnameMap, XMLStreamWriter out, boolean writeEnclosingDocument, boolean namespaceRepairingMode, NameCoder nameCoder) throws XMLStreamException

Allows a StaxWriter to be created for partial XML output

Parameters
qnameMap:QNameMap

is the mapper of Java class names to QNames

out:XMLStreamWriter

the stream to output to

writeEnclosingDocument:boolean

a flag to indicate whether or not the start/end document events should be written

namespaceRepairingMode:boolean

a flag to enable StAX' namespace repairing mode

nameCoder:NameCoder

the xml-friendly replacer to escape Java names

Exceptions
XMLStreamException:
if the events could not be written to the output
Since
1.4
StaxWriterback to summary
public StaxWriter(QNameMap qnameMap, XMLStreamWriter out, boolean writeEnclosingDocument, boolean namespaceRepairingMode) throws XMLStreamException

Allows a StaxWriter to be created for partial XML output

Parameters
qnameMap:QNameMap

is the mapper of Java class names to QNames

out:XMLStreamWriter

the stream to output to

writeEnclosingDocument:boolean

a flag to indicate whether or not the start/end document events should be written

Exceptions
XMLStreamException:
if the events could not be written to the output
StaxWriterback to summary
public StaxWriter(QNameMap qnameMap, XMLStreamWriter out, boolean writeEnclosingDocument, boolean namespaceRepairingMode, XmlFriendlyReplacer replacer) throws XMLStreamException

Allows a StaxWriter to be created for partial XML output

Parameters
qnameMap:QNameMap

is the mapper of Java class names to QNames

out:XMLStreamWriter

the stream to output to

writeEnclosingDocument:boolean

a flag to indicate whether or not the start/end document events should be written

replacer:XmlFriendlyReplacer

the xml-friendly replacer to escape Java names

Exceptions
XMLStreamException:
if the events could not be written to the output
Since
1.2

Method Detail

addAttributeback to summary
public void addAttribute(String name, String value)

Implements com.thoughtworks.xstream.io.HierarchicalStreamWriter.addAttribute.

closeback to summary
public void close()

Implements com.thoughtworks.xstream.io.HierarchicalStreamWriter.close.

Call this method when you're finished with me

endNodeback to summary
public void endNode()

Implements com.thoughtworks.xstream.io.HierarchicalStreamWriter.endNode.

flushback to summary
public void flush()

Implements com.thoughtworks.xstream.io.HierarchicalStreamWriter.flush.

Doc from com.thoughtworks.xstream.io.HierarchicalStreamWriter.flush.

Flush the writer, if necessary.

getQNameMapback to summary
protected QNameMap getQNameMap()
getXMLStreamWriterback to summary
protected XMLStreamWriter getXMLStreamWriter()
isNamespaceRepairingModeback to summary
public boolean isNamespaceRepairingMode()

Is StAX namespace repairing mode on or off?

setValueback to summary
public void setValue(String text)

Implements com.thoughtworks.xstream.io.HierarchicalStreamWriter.setValue.

Doc from com.thoughtworks.xstream.io.HierarchicalStreamWriter.setValue.

Write the value (text content) of the current node.

startNodeback to summary
public void startNode(String name)

Implements com.thoughtworks.xstream.io.HierarchicalStreamWriter.startNode.