public abstract class AbstractDocumentWriter extends AbstractXmlWriter implements DocumentWriter
HierarchicalStreamWriter for DOM writer
implementations. The implementation manages a list of top level DOM nodes. Every time the
last node is closed on the node stack, the next started node is added to the list. This list
can be retrieved using the DocumentWriter.getTopLevelNodes() method.| Constructor and Description |
|---|
AbstractDocumentWriter(Object container,
XmlFriendlyReplacer replacer)
Constructs an AbstractDocumentWriter.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the writer, if necessary.
|
protected abstract Object |
createNode(String name)
Create a node.
|
void |
endNode() |
void |
endNodeInternally()
Called when a node ends.
|
void |
flush()
Flush the writer, if necessary.
|
protected Object |
getCurrent() |
List |
getTopLevelNodes()
Retrieve a
List with the top elements. |
void |
startNode(String name) |
escapeXmlName, startNode, underlyingWriterclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddAttribute, setValue, underlyingWriterpublic AbstractDocumentWriter(Object container, XmlFriendlyReplacer replacer)
container - the top level container for the nodes to create (may be
null)replacer - the object that creates XML-friendly namespublic final void startNode(String name)
startNode in interface HierarchicalStreamWriterprotected abstract Object createNode(String name)
getCurrent()
returns null the node is a top level node.name - the node namepublic final void endNode()
endNode in interface HierarchicalStreamWriterpublic void endNodeInternally()
protected final Object getCurrent()
public List getTopLevelNodes()
DocumentWriterList with the top elements. In the standard use case this list will
only contain a single element. Additional elements can only occur, if
HierarchicalStreamWriter.startNode(String) of the implementing
HierarchicalStreamWriter was called multiple times with an empty node stack. Such
a situation occurs calling
XStream.marshal(Object, HierarchicalStreamWriter)
multiple times directly.getTopLevelNodes in interface DocumentWriterList with top nodespublic void flush()
HierarchicalStreamWriterflush in interface HierarchicalStreamWriterpublic void close()
HierarchicalStreamWriterclose in interface HierarchicalStreamWriterCopyright © 2020 Internet2. All rights reserved.