public class XmlMarshallingContext extends MarshallingContext
MarshallingContext
for XML records.Modifier and Type | Field and Description |
---|---|
protected Document |
document |
protected Node |
parent |
MARSHALLING, UNMARSHALLING
Constructor and Description |
---|
XmlMarshallingContext(int groupDepth)
Constructs a new XmlMarshallingContext.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear is invoked after each bean object (record or group) is marshalled.
|
void |
closeGroup(XmlNode node)
Indicates a group element should be closed before marshalling the next record.
|
Document |
getDocument()
Returns the document being marshalled.
|
Node |
getParent()
Returns the parent node to append in the document being marshalled.
|
Object |
getRecordObject()
Returns the record object to pass to the
RecordWriter when
MarshallingContext.writeRecord() is called. |
boolean |
isStreaming()
Returns whether a stream is being marshalled, versus a single document.
|
void |
openGroup(XmlNode node)
Adds a group to be marshalled when the next record is written to
the output stream.
|
void |
setParent(Node parent)
Sets the parent node to append in the document being marshalled.
|
void |
setStreaming(boolean streaming)
Sets whether a stream is being marshalled, versus a single document.
|
Document |
toDocument(Object record)
Converts a record object to a
Document . |
void |
writeRecord()
Writes the current record object to the record writer.
|
getBean, getComponentName, getMode, getRecordWriter, setBean, setComponentName, setRecordWriter, toArray, toList
createHeap, getAdjustedFieldPosition, getLocal, getRelativeFieldIndex, isRepeating, popIteration, pushIteration, setLocal
public XmlMarshallingContext(int groupDepth)
groupDepth
- the maximum depth of a group in the parser treepublic void clear()
MarshallingContext
clear
in class MarshallingContext
public Object getRecordObject()
MarshallingContext
RecordWriter
when
MarshallingContext.writeRecord()
is called.getRecordObject
in class MarshallingContext
public void writeRecord() throws IOException
MarshallingContext
MarshallingContext.getRecordObject()
method.writeRecord
in class MarshallingContext
IOException
- if an I/O error occurspublic Document getDocument()
Document
being marshalledpublic void openGroup(XmlNode node)
node
- the group element to addpublic void closeGroup(XmlNode node)
node
- the XmlNode
to closepublic Node getParent()
Node
public void setParent(Node parent)
parent
- the parent Node
public Document toDocument(Object record)
MarshallingContext
Document
.toDocument
in class MarshallingContext
record
- the record object to convertDocument
result, or null if not supportedpublic void setStreaming(boolean streaming)
streaming
- true if marshalling a stream, false if marshalling single documentspublic boolean isStreaming()