org.eclipse.persistence.oxm.record
public class FormattedOutputStreamRecord extends OutputStreamRecord
Use this type of MarshalRecord when the marshal target is an OutputStream and the XML should be formatted with carriage returns and indenting. This type is only used if the encoding of the OutputStream is UTF-8
XMLContext xmlContext = new XMLContext("session-name");
XMLMarshaller xmlMarshaller = xmlContext.createMarshaller();
FormattedOutputStreamRecord record = new FormattedOutputStreamRecord();
record.setOutputStream(myOutputStream);
xmlMarshaller.marshal(myObject, record);
If the marshal(OutputStream) and setFormattedOutput(true) method is called on XMLMarshaller and the encoding is UTF-8, then the OutputStream is automatically wrapped in a FormattedOutputStreamRecord.
XMLContext xmlContext = new XMLContext("session-name");
XMLMarshaller xmlMarshaller = xmlContext.createMarshaller();
xmlMarshaller xmlMarshaller.setFormattedOutput(true);
xmlMarshaller.marshal(myObject, myOutputStream);
XMLMarshaller
,
Serialized FormConstructor and Description |
---|
FormattedOutputStreamRecord() |
Modifier and Type | Method and Description |
---|---|
void |
cdata(String value)
INTERNAL:
|
void |
characters(String value)
INTERNAL:
|
void |
element(org.eclipse.persistence.internal.oxm.XPathFragment frag)
INTERNAL:
|
void |
endDocument()
INTERNAL:
|
void |
endElement(org.eclipse.persistence.internal.oxm.XPathFragment xPathFragment,
NamespaceResolver namespaceResolver)
INTERNAL:
|
void |
node(Node node,
NamespaceResolver namespaceResolver)
Receive notification of a node.
|
void |
openStartElement(org.eclipse.persistence.internal.oxm.XPathFragment xPathFragment,
NamespaceResolver namespaceResolver)
INTERNAL:
|
attribute, attribute, closeStartElement, flush, getOutputStream, setOutputStream, startDocument, startPrefixMappings
add, addGroupingElement, clear, closeStartGroupingElements, endPrefixMapping, endPrefixMappings, getDocument, getDOM, getLocalName, getNamespaceURI, getPositionalNodes, namespaceDeclarations, openStartGroupingElements, put, removeGroupingElement, startPrefixMapping, transformToXML
contains, get, getCurrentObject, getDocPresPolicy, getIndicatingNoEntry, getLeafElementType, getMarshaller, getNamespaceResolver, getOwningObject, getSession, getUnmarshaller, isXOPPackage, resolveNamespacePrefix, setCurrentObject, setDocPresPolicy, setLeafElementType, setMarshaller, setNamespaceResolver, setOwningObject, setSession, setUnmarshaller, setXOPPackage
clone, containsKey, containsKey, containsKey, containsValue, elements, entrySet, get, get, getField, getFields, getIndicatingNoEntry, getValues, getValues, getValues, isEmpty, keys, keySet, mergeFrom, put, put, putAll, remove, remove, remove, replaceAt, size, toString, values
public void endDocument()
endDocument
in class OutputStreamRecord
public void openStartElement(org.eclipse.persistence.internal.oxm.XPathFragment xPathFragment, NamespaceResolver namespaceResolver)
openStartElement
in class OutputStreamRecord
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(org.eclipse.persistence.internal.oxm.XPathFragment frag)
element
in class OutputStreamRecord
frag
- The XPathFragment of the elementpublic void endElement(org.eclipse.persistence.internal.oxm.XPathFragment xPathFragment, NamespaceResolver namespaceResolver)
endElement
in class OutputStreamRecord
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(String value)
characters
in class OutputStreamRecord
value
- This is the entire value of the text node.public void cdata(String value)
cdata
in class OutputStreamRecord
value
- This is the value of the text to be wrappedpublic void node(Node node, NamespaceResolver namespaceResolver)
node
in class OutputStreamRecord
node
- The Node to be added to the documentnamespaceResolver
- The NamespaceResolver can be used to resolve the
namespace URI/prefix of the node