org.eclipse.persistence.oxm

Class XMLMarshaller

    • Constructor Summary

      Constructors 
      Constructor and Description
      XMLMarshaller(XMLContext xmlContext)
      Create a new XMLMarshaller based on the specified session
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      XMLMarshaller clone() 
      MediaType getMediaType()
      Get the MediaType for this xmlMarshaller.
      NamespacePrefixMapper getNamespacePrefixMapper()
      NamespacePrefixMapper that can be used during marshal (instead of those set in the project meta data)
      java.util.Properties getProperties()
      Return a properties object for a given instance of the XMLMarshaller.
      XMLContext getXMLContext()
      Return the instance of XMLContext that was used to create this instance of XMLMarshaller.
      void marshal(java.lang.Object object, javax.xml.transform.Result result)
      PUBLIC: Convert the given object to XML and update the given result with that XML Document
      org.w3c.dom.Document objectToXML(java.lang.Object object, org.w3c.dom.Node parent)
      Deprecated.  
      org.w3c.dom.Document objectToXML(java.lang.Object object, org.w3c.dom.Node parent, DocumentPreservationPolicy docPresPolicy) 
      org.w3c.dom.Document objectToXML(java.lang.Object object, org.w3c.dom.Node rootNode, XMLDescriptor descriptor, XMLRecord xmlRow, boolean isXMLRoot, DocumentPreservationPolicy docPresPolicy) 
      org.w3c.dom.Document objectToXML(java.lang.Object object, XMLDescriptor descriptor, XMLRecord xmlRow, boolean isXMLRoot, DocumentPreservationPolicy docPresPolicy)
      INTERNAL: Convert the given object to an XML Document
      void setMediaType(MediaType mediaType)
      Set the MediaType for this xmlMarshaller.
      void setNamespacePrefixMapper(NamespacePrefixMapper mapper)
      NamespacePrefixMapper that can be used during marshal (instead of those set in the project meta data)
      void setXMLContext(XMLContext value)
      Set the XMLContext used by this instance of XMLMarshaller.
      void setXMLMarshalHandler(XMLMarshalListener marshalListener) 
      • Methods inherited from class org.eclipse.persistence.internal.oxm.XMLMarshaller

        getAttachmentMarshaller, getAttributePrefix, getDescriptor, getMarshalAttributeGroup, getNamespaceSeparator, getNoNamespaceSchemaLocation, getSchema, getSchemaLocation, getTransformer, getValueWrapper, getXmlHeader, isFragment, isIncludeRoot, isMarshalEmptyCollections, isReduceAnyArrays, isWrapperAsCollectionName, marshal, marshal, marshal, marshal, marshal, marshal, objectToXML, setAttachmentMarshaller, setAttributePrefix, setEncoding, setFormattedOutput, setFragment, setIncludeRoot, setMarshalAttributeGroup, setMarshalEmptyCollections, setNamespaceSeparator, setNoNamespaceSchemaLocation, setReduceAnyArrays, setSchema, setSchemaLocation, setValueWrapper, setWrapperAsCollectionName, setXmlHeader
      • Methods inherited from class org.eclipse.persistence.internal.oxm.Marshaller

        getCharacterEscapeHandler, getContext, getEncoding, getErrorHandler, getIndentString, getMarshalListener, getProperty, isEqualUsingIdenity, isFormattedOutput, setCharacterEscapeHandler, setEqualUsingIdenity, setErrorHandler, setIndentString, setMarshalListener
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • XMLMarshaller

        public XMLMarshaller(XMLContext xmlContext)
        Create a new XMLMarshaller based on the specified session
        Parameters:
        session - A single session
    • Method Detail

      • getXMLContext

        public XMLContext getXMLContext()
        Return the instance of XMLContext that was used to create this instance of XMLMarshaller.
      • setXMLContext

        public void setXMLContext(XMLContext value)
        Set the XMLContext used by this instance of XMLMarshaller.
      • getProperties

        public java.util.Properties getProperties()
        Return a properties object for a given instance of the XMLMarshaller.
        Returns:
      • setXMLMarshalHandler

        public void setXMLMarshalHandler(XMLMarshalListener marshalListener)
      • marshal

        public void marshal(java.lang.Object object,
                   javax.xml.transform.Result result)
                     throws XMLMarshalException
        PUBLIC: Convert the given object to XML and update the given result with that XML Document
        Overrides:
        marshal in class org.eclipse.persistence.internal.oxm.XMLMarshaller<org.eclipse.persistence.internal.sessions.AbstractSession,XMLContext,XMLDescriptor,MediaType,NamespacePrefixMapper,org.eclipse.persistence.internal.oxm.TreeObjectBuilder>
        Parameters:
        object - the object to marshal
        result - the result to marshal the object to
        Throws:
        XMLMarshalException - if an error occurred during marshalling
      • objectToXML

        public org.w3c.dom.Document objectToXML(java.lang.Object object,
                                       org.w3c.dom.Node parent)
                                         throws XMLMarshalException
        Deprecated. 
        PUBLIC: Convert the given object to descendants of the parent element
        Parameters:
        object - the object to marshal
        parent - the node to marshal the object to
        Returns:
        the document which the specified object has been marshalled to
        Throws:
        XMLMarshalException - if an error occurred during marshalling
      • objectToXML

        public org.w3c.dom.Document objectToXML(java.lang.Object object,
                                       org.w3c.dom.Node parent,
                                       DocumentPreservationPolicy docPresPolicy)
      • objectToXML

        public org.w3c.dom.Document objectToXML(java.lang.Object object,
                                       XMLDescriptor descriptor,
                                       XMLRecord xmlRow,
                                       boolean isXMLRoot,
                                       DocumentPreservationPolicy docPresPolicy)
        INTERNAL: Convert the given object to an XML Document
      • clone

        public XMLMarshaller clone()
        Overrides:
        clone in class java.lang.Object
      • setNamespacePrefixMapper

        public void setNamespacePrefixMapper(NamespacePrefixMapper mapper)
        NamespacePrefixMapper that can be used during marshal (instead of those set in the project meta data)
        Overrides:
        setNamespacePrefixMapper in class org.eclipse.persistence.internal.oxm.Marshaller<XMLContext,MediaType,NamespacePrefixMapper>
        Since:
        2.3.3
      • getNamespacePrefixMapper

        public NamespacePrefixMapper getNamespacePrefixMapper()
        NamespacePrefixMapper that can be used during marshal (instead of those set in the project meta data)
        Overrides:
        getNamespacePrefixMapper in class org.eclipse.persistence.internal.oxm.Marshaller<XMLContext,MediaType,NamespacePrefixMapper>
        Returns:
        Since:
        2.3.3
      • setMediaType

        public void setMediaType(MediaType mediaType)
        Set the MediaType for this xmlMarshaller. See org.eclipse.persistence.oxm.MediaType for the media types supported by EclipseLink MOXy
        Overrides:
        setMediaType in class org.eclipse.persistence.internal.oxm.XMLMarshaller<org.eclipse.persistence.internal.sessions.AbstractSession,XMLContext,XMLDescriptor,MediaType,NamespacePrefixMapper,org.eclipse.persistence.internal.oxm.TreeObjectBuilder>
        Parameters:
        mediaType -
        Since:
        EclipseLink 2.4.0
      • getMediaType

        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
        Overrides:
        getMediaType in class org.eclipse.persistence.internal.oxm.XMLMarshaller<org.eclipse.persistence.internal.sessions.AbstractSession,XMLContext,XMLDescriptor,MediaType,NamespacePrefixMapper,org.eclipse.persistence.internal.oxm.TreeObjectBuilder>
        Returns:
        MediaType
        Since:
        EclipseLink 2.4.0