Class used to marshal object to XML.
Create an XMLMarshaller from an XMLContext.
Code Sample
XMLContext context = new XMLContext("mySessionName");
XMLMarshaller marshaller = context.createMarshaller();
Objects can be marshalled to the following outputs:
Objects that can be marshalled are those which are mapped in the TopLink project associated with the XMLContext, and which are mapped to an XMLDescriptor that has a default root element specified.
org.eclipse.persistence.oxm.XMLContext
| Modifier and Type | Field and Description |
|---|---|
| private JsonTypeConfiguration | |
| private Object |
| Access | Constructor and Description |
|---|---|
| public | XMLMarshaller(XMLContext
the XML content xmlContext)Create a new XMLMarshaller based on the specified session |
| protected |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| public XMLMarshaller | |
| public CharacterEscapeHandler | getCharacterEscapeHandler()
Overrides org. |
| protected XMLDescriptor | |
| public JsonTypeConfiguration | Returns: json type configurationImplements abstract org. |
| public XMLMarshalListener | |
| public MediaType | |
| public NamespacePrefixMapper | getNamespacePrefixMapper()
Overrides org. |
| protected Node | getNode(Object object, Node parentNode, AbstractSession session, XMLDescriptor xmlDescriptor, boolean isXMLRoot)
Overrides org. |
| public Properties | |
| public XMLContext | getXMLContext()
Return the instance of XMLContext that was used to create this instance of XMLMarshaller. |
| public void | marshal(Object
the object to marshal object, Result the result to marshal the object to result)Overrides org. |
| protected void | marshal(Object
the object to marshal object, AbstractSession session, MarshalRecord<MARSHALLER extends Marshaller> the marshalRecord to marshal the object to marshalRecord)Convert the given object to XML and update the given marshal record with that XML Document. |
| protected Document | Returns: the document which the specified object has been marshalled tothe object to marshal object, XMLDescriptor the XMLDescriptor for the object being marshalled descriptor, boolean isXMLRoot)Overrides org. |
| public Document | |
| public Document | objectToXML(Object object, XMLDescriptor descriptor, XMLRecord xmlRow, boolean isXMLRoot, DocumentPreservationPolicy docPresPolicy)
INTERNAL: Convert the given object to an XML Document |
| public Document | objectToXML(Object object, Node rootNode, XMLDescriptor descriptor, XMLRecord xmlRow, boolean isXMLRoot, DocumentPreservationPolicy docPresPolicy)
|
| protected Node | objectToXMLNode(Object object, Node rootNode, AbstractSession session, XMLDescriptor descriptor, boolean isXMLRoot)
Overrides org. |
| public void | setCharacterEscapeHandler(CharacterEscapeHandler c)
Overrides org. |
| public void | |
| public void | setMediaType(MediaType mediaType)
Overrides org. |
| public void | setNamespacePrefixMapper(NamespacePrefixMapper mapper)
Overrides org. |
| public void | |
| public void |
| jsonTypeConfiguration | back to summary |
|---|---|
| private JsonTypeConfiguration jsonTypeConfiguration | |
| marshalAttributeGroup | back to summary |
|---|---|
| private Object marshalAttributeGroup Hides org. | |
| XMLMarshaller | back to summary |
|---|---|
| public XMLMarshaller(XMLContext xmlContext) Create a new XMLMarshaller based on the specified session
| |
| XMLMarshaller | back to summary |
|---|---|
| protected XMLMarshaller(XMLMarshaller xmlMarshaller) Copy constructor | |
| addSchemaLocations | back to summary |
|---|---|
| private void addSchemaLocations(Document document, AbstractSession session) | |
| clone | back to summary |
|---|---|
| public XMLMarshaller clone() Overrides java. Doc from java. Creates and returns a copy of this object. The precise meaning
of "copy" may depend on the class of the object. The general
intent is that, for any object will be true, and that the expression:x.clone() != x will bex.clone().getClass() == x.getClass() true, but these are not absolute requirements.
While it is typically the case that:
will bex.clone().equals(x) true, this is not an absolute requirement.
By convention, the returned object should be obtained by calling
By convention, the object returned by this method should be independent
of this object (which is being cloned). To achieve this independence,
it may be necessary to modify one or more fields of the object returned
by
| |
| getCharacterEscapeHandler | back to summary |
|---|---|
| public CharacterEscapeHandler getCharacterEscapeHandler() Overrides org. Return this Marshaller's CharacterEscapeHandler.
| |
| getDescriptor | back to summary |
|---|---|
| protected XMLDescriptor getDescriptor(Object object, AbstractSession session, boolean isXMLRoot) | |
| getJsonTypeConfiguration | back to summary |
|---|---|
| public JsonTypeConfiguration getJsonTypeConfiguration() Implements abstract org. Returns json type configuration.
| |
| getMarshalListener | back to summary |
|---|---|
| public XMLMarshalListener getMarshalListener() Overrides org.
| |
| getMediaType | back to summary |
|---|---|
| public MediaType getMediaType() Get the MediaType for this xmlMarshaller. See org.eclipse.persistence.oxm.MediaType for the media types supported by EclipseLink MOXy If not set the default is MediaType.APPLICATION_XML
| |
| getNamespacePrefixMapper | back to summary |
|---|---|
| public NamespacePrefixMapper getNamespacePrefixMapper() Overrides org. NamespacePrefixMapper that can be used during marshal (instead of those set in the project meta data)
| |
| getNode | back to summary |
|---|---|
| protected Node getNode(Object object, Node parentNode, AbstractSession session, XMLDescriptor xmlDescriptor, boolean isXMLRoot) Overrides org.
| |
| getProperties | back to summary |
|---|---|
| public Properties getProperties() Return a properties object for a given instance of the XMLMarshaller. | |
| getXMLContext | back to summary |
|---|---|
| public XMLContext getXMLContext() Return the instance of XMLContext that was used to create this instance of XMLMarshaller. | |
| marshal | back to summary |
|---|---|
| public void marshal(Object object, Result result) throws XMLMarshalException Overrides org. PUBLIC: Convert the given object to XML and update the given result with that XML Document
| |
| marshal | back to summary |
|---|---|
| protected void marshal(Object object, AbstractSession session, MarshalRecord<MARSHALLER extends Marshaller> marshalRecord) Convert the given object to XML and update the given marshal record with that XML Document.
| |
| objectToXML | back to summary |
|---|---|
| protected Document objectToXML(Object object, XMLDescriptor descriptor, boolean isXMLRoot) throws XMLMarshalException Overrides org. INTERNAL: Convert the given object to an XML Document
| |
| objectToXML | back to summary |
|---|---|
| public Document objectToXML(Object object, Node parent, DocumentPreservationPolicy docPresPolicy) | |
| objectToXML | back to summary |
|---|---|
| public Document objectToXML(Object object, XMLDescriptor descriptor, XMLRecord xmlRow, boolean isXMLRoot, DocumentPreservationPolicy docPresPolicy) INTERNAL: Convert the given object to an XML Document | |
| objectToXML | back to summary |
|---|---|
| public Document objectToXML(Object object, Node rootNode, XMLDescriptor descriptor, XMLRecord xmlRow, boolean isXMLRoot, DocumentPreservationPolicy docPresPolicy) | |
| objectToXMLNode | back to summary |
|---|---|
| protected Node objectToXMLNode(Object object, Node rootNode, AbstractSession session, XMLDescriptor descriptor, boolean isXMLRoot) throws XMLMarshalException Overrides org.
| |
| setCharacterEscapeHandler | back to summary |
|---|---|
| public void setCharacterEscapeHandler(CharacterEscapeHandler c) Overrides org. Set this Marshaller's CharacterEscapeHandler.
| |
| setMarshalListener | back to summary |
|---|---|
| public void setMarshalListener(XMLMarshalListener listener) Overrides org.
| |
| setMediaType | back to summary |
|---|---|
| public void setMediaType(MediaType mediaType) Overrides org. Set the MediaType for this xmlMarshaller. See org.eclipse.persistence.oxm.MediaType for the media types supported by EclipseLink MOXy
| |
| setNamespacePrefixMapper | back to summary |
|---|---|
| public void setNamespacePrefixMapper(NamespacePrefixMapper mapper) Overrides org. NamespacePrefixMapper that can be used during marshal (instead of those set in the project meta data)
| |
| setXMLContext | back to summary |
|---|---|
| public void setXMLContext(XMLContext value) Set the XMLContext used by this instance of XMLMarshaller. | |
| setXMLMarshalHandler | back to summary |
|---|---|
| public void setXMLMarshalHandler(XMLMarshalListener marshalListener) | |