public class FormattedWriterRecord extends WriterRecord
Use this type of MarshalRecord when the marshal target is a Writer and the XML should be formatted with carriage returns and indenting.
XMLContext xmlContext = new XMLContext("session-name");
XMLMarshaller xmlMarshaller = xmlContext.createMarshaller();
FormattedWriterRecord formattedWriterRecord = new FormattedWriterRecord();
formattedWriterRecord.setWriter(myWriter);
xmlMarshaller.marshal(myObject, formattedWriterRecord);
If the marshal(Writer) and setFormattedOutput(true) method is called on XMLMarshaller, then the Writer is automatically wrapped in a FormattedWriterRecord.
XMLContext xmlContext = new XMLContext("session-name");
XMLMarshaller xmlMarshaller = xmlContext.createMarshaller();
xmlMarshaller xmlMarshaller.setFormattedOutput(true);
xmlMarshaller.marshal(myObject, myWriter);
XMLMarshaller
,
Serialized FormMarshalRecord.CycleDetectionStack<E>
AbstractRecord.NoEntry
noEntry
Constructor and Description |
---|
FormattedWriterRecord() |
Modifier and Type | Method and Description |
---|---|
void |
cdata(java.lang.String value)
INTERNAL:
|
void |
characters(java.lang.String value)
INTERNAL:
|
void |
element(XPathFragment frag)
INTERNAL:
|
void |
endDocument()
INTERNAL:
|
void |
endElement(XPathFragment xPathFragment,
NamespaceResolver namespaceResolver)
INTERNAL:
|
void |
node(org.w3c.dom.Node node,
NamespaceResolver namespaceResolver,
java.lang.String newNamespace,
java.lang.String newName)
Receive notification of a node.
|
void |
openStartElement(XPathFragment xPathFragment,
NamespaceResolver namespaceResolver)
INTERNAL:
|
void |
writeHeader()
INTERNAL
|
attribute, attribute, closeStartElement, getWriter, setMarshaller, setWriter, startDocument, startPrefixMappings
add, addGroupingElement, afterContainmentMarshal, attribute, beforeContainmentMarshal, characters, clear, closeStartGroupingElements, defaultNamespaceDeclaration, emptyAttribute, emptyCollection, emptyComplex, emptySimple, endCollection, endPrefixMapping, endPrefixMappings, getCycleDetectionStack, getDocument, getDOM, getGroupingElements, getLocalName, getNamespaceURI, getPositionalNodes, getTextWrapperFragment, getValueToWrite, isWrapperAsCollectionName, marshalWithoutRootElement, namespaceDeclaration, namespaceDeclarations, nilComplex, nilSimple, node, openStartGroupingElements, predicateAttribute, put, removeGroupingElement, setGroupingElement, setSession, startCollection, startPrefixMapping, transformToXML
attributeWithoutQName, contains, get, get, getCurrentObject, getDocPresPolicy, getIndicatingNoEntry, getLeafElementType, getMarshaller, getNamespaceResolver, getNamespaceSeparator, getOwningObject, getSession, getUnmarshaller, hasCustomNamespaceMapper, hasEqualNamespaceResolvers, isNamespaceAware, isXOPPackage, put, resolveNamespacePrefix, setCurrentObject, setCustomNamespaceMapper, setDocPresPolicy, setEqualNamespaceResolvers, setLeafElementType, setLeafElementType, setNamespaceResolver, setOwningObject, setUnmarshaller, setXOPPackage
clone, containsKey, containsKey, containsKey, containsValue, elements, entrySet, get, getField, getFields, getIndicatingNoEntry, getValues, getValues, getValues, hasNullValueInFields, isEmpty, keys, keySet, mergeFrom, put, putAll, remove, remove, remove, replaceAt, setNullValueInFields, size, toString, values
public void endDocument()
endDocument
in class WriterRecord
public void writeHeader()
writeHeader
in class WriterRecord
public void openStartElement(XPathFragment xPathFragment, NamespaceResolver namespaceResolver)
openStartElement
in class WriterRecord
xPathFragment
- The XPathFragment contains the name and prefix
information about the XML element being ended.namespaceResolver
- The NamespaceResolver can be used to resolve the
namespace URI for the namespace prefix held by the XPathFragment (if
required).public void element(XPathFragment frag)
element
in class WriterRecord
frag
- The XPathFragment of the elementpublic void endElement(XPathFragment xPathFragment, NamespaceResolver namespaceResolver)
endElement
in class WriterRecord
xPathFragment
- The XPathFragment contains the name and prefix
information about the XML element being ended.namespaceResolver
- The NamespaceResolver can be used to resolve the
namespace URI for the namespace prefix held by the XPathFragment (if
required).public void characters(java.lang.String value)
characters
in class WriterRecord
value
- This is the entire value of the text node.public void cdata(java.lang.String value)
cdata
in class WriterRecord
value
- This is the value of the text to be wrappedpublic void node(org.w3c.dom.Node node, NamespaceResolver namespaceResolver, java.lang.String newNamespace, java.lang.String newName)
node
in class WriterRecord
node
- The Node to be added to the documentnamespaceResolver
- The NamespaceResolver can be used to resolve the
namespace URI/prefix of the nodenewName
- replacement root namespace for the node
namespace URI/prefix of the nodeEclipseLink 2.4.2, "build v20130514-5956486" API Reference