|
Oracle® Fusion Middleware Java API Reference for EclipseLink 11g Release 1 (11.1.1) E26376-01 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
org.eclipse.persistence.oxm.XMLMarshaller
public class XMLMarshaller
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.
XMLContext
Constructor Summary | |
---|---|
XMLMarshaller(XMLContext xmlContext) Create a new XMLMarshaller based on the specified session |
Method Summary | |
---|---|
XMLMarshaller |
clone() |
XMLAttachmentMarshaller |
getAttachmentMarshaller() |
protected XMLDescriptor |
getDescriptor(java.lang.Object object) INTERNAL: Return the descriptor for the root object. |
protected XMLDescriptor |
getDescriptor(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Return the descriptor for the root object. |
protected XMLDescriptor |
getDescriptor(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractSession session, boolean isXMLRoot) |
protected XMLDescriptor |
getDescriptor(java.lang.Object object, boolean isXMLRoot) |
protected XMLDescriptor |
getDescriptor(XMLRoot object) |
protected XMLDescriptor |
getDescriptor(XMLRoot object, org.eclipse.persistence.internal.sessions.AbstractSession session) |
java.lang.String |
getEncoding() Get the encoding set on this XMLMarshaller If the encoding has not been set the default UTF-8 will be used |
org.xml.sax.ErrorHandler |
getErrorHandler() |
XMLMarshalListener |
getMarshalListener() |
java.lang.String |
getNoNamespaceSchemaLocation() Get the no namespace schema location set on this XMLMarshaller |
java.util.Properties |
getProperties() Return a properties object for a given instance of the XMLMarshaller. |
java.lang.Object |
getProperty(java.lang.Object key) Return the property for a given key, if one exists. |
javax.xml.validation.Schema |
getSchema() |
java.lang.String |
getSchemaLocation() Get the schema location set on this XMLMarshaller |
XMLTransformer |
getTransformer() INTERNAL |
XMLContext |
getXMLContext() Return the instance of XMLContext that was used to create this instance of XMLMarshaller. |
boolean |
isFormattedOutput() Returns if this XMLMarshaller should format the XML By default this is set to true and the XML marshalled will be formatted. |
boolean |
isFragment() PUBLIC: Returns if this should marshal to a fragment. |
protected void |
marshal(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractSession session, MarshalRecord marshalRecord) Convert the given object to XML and update the given marshal record with that XML Document. |
void |
marshal(java.lang.Object object, org.xml.sax.ContentHandler contentHandler) PUBLIC: Convert the given object to XML and update the given contentHandler with that XML Document |
void |
marshal(java.lang.Object object, org.xml.sax.ContentHandler contentHandler, org.xml.sax.ext.LexicalHandler lexicalHandler) PUBLIC: Convert the given object to XML and update the given contentHandler with that XML Document |
void |
marshal(java.lang.Object object, MarshalRecord marshalRecord) Convert the given object to XML and update the given marshal record with that XML Document. |
void |
marshal(java.lang.Object object, org.w3c.dom.Node node) PUBLIC: Convert the given object to XML and update the given node with that XML Document |
void |
marshal(java.lang.Object object, java.io.OutputStream outputStream) PUBLIC: Convert the given object to XML and update the given outputStream with that XML Document |
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 |
void |
marshal(java.lang.Object object, java.io.Writer writer) PUBLIC: Convert the given object to XML and update the given writer with that XML Document |
org.w3c.dom.Document |
objectToXML(java.lang.Object object) PUBLIC: Convert the given object to an 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) |
protected org.w3c.dom.Document |
objectToXML(java.lang.Object object, XMLDescriptor descriptor, boolean isXMLRoot) INTERNAL: Convert the given object to an XML Document |
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 |
protected org.w3c.dom.Node |
objectToXMLNode(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractSession session, XMLDescriptor descriptor, boolean isXMLRoot) INTERNAL: Like ObjectToXML but is may also return a document fragment instead of a document in the case of a non-root object. |
protected org.w3c.dom.Node |
objectToXMLNode(java.lang.Object object, org.w3c.dom.Node rootNode, org.eclipse.persistence.internal.sessions.AbstractSession session, XMLDescriptor descriptor, boolean isXMLRoot) |
void |
setAttachmentMarshaller(XMLAttachmentMarshaller atm) |
void |
setEncoding(java.lang.String newEncoding) Set the encoding on this XMLMarshaller If the encoding is not set the default UTF-8 will be used |
void |
setErrorHandler(org.xml.sax.ErrorHandler errorHandler) |
void |
setFormattedOutput(boolean shouldFormat) Set if this XMLMarshaller should format the XML By default this is set to true and the XML marshalled will be formatted. |
void |
setFragment(boolean fragment) PUBLIC: Set if this should marshal to a fragment. |
void |
setMarshalListener(XMLMarshalListener listener) |
void |
setNoNamespaceSchemaLocation(java.lang.String newNoNamespaceSchemaLocation) Set the no namespace schema location on this XMLMarshaller |
void |
setSchema(javax.xml.validation.Schema schema) |
void |
setSchemaLocation(java.lang.String newSchemaLocation) Set the schema location on this XMLMarshaller |
void |
setXMLContext(XMLContext value) Set the XMLContext used by this instance of XMLMarshaller. |
void |
setXMLMarshalHandler(XMLMarshalListener marshalListener) |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XMLMarshaller(XMLContext xmlContext)
session
- A single sessionMethod Detail |
---|
public XMLContext getXMLContext()
public void setXMLContext(XMLContext value)
public org.xml.sax.ErrorHandler getErrorHandler()
public void setErrorHandler(org.xml.sax.ErrorHandler errorHandler)
public boolean isFormattedOutput()
public void setFormattedOutput(boolean shouldFormat)
shouldFormat
- if this XMLMarshaller should format the XMLpublic java.lang.String getEncoding()
public void setEncoding(java.lang.String newEncoding)
newEncoding
- the encoding to set on this XMLMarshallerpublic java.lang.String getSchemaLocation()
public void setSchemaLocation(java.lang.String newSchemaLocation)
newSchemaLocation
- the schema location to be seton this XMLMarshallerpublic java.lang.String getNoNamespaceSchemaLocation()
public java.util.Properties getProperties()
public java.lang.Object getProperty(java.lang.Object key)
public void setNoNamespaceSchemaLocation(java.lang.String newNoNamespaceSchemaLocation)
newNoNamespaceSchemaLocation
- no namespace schema location to be seton this XMLMarshallerpublic void setXMLMarshalHandler(XMLMarshalListener marshalListener)
public XMLMarshalListener getMarshalListener()
public void setMarshalListener(XMLMarshalListener listener)
public void marshal(java.lang.Object object, javax.xml.transform.Result result) throws XMLMarshalException
object
- the object to marshalresult
- the result to marshal the object toXMLMarshalException
- if an error occurred during marshallingpublic void marshal(java.lang.Object object, java.io.OutputStream outputStream) throws XMLMarshalException
object
- the object to marshaloutputStream
- the outputStream to marshal the object toXMLMarshalException
- if an error occurred during marshallingpublic void marshal(java.lang.Object object, java.io.Writer writer) throws XMLMarshalException
object
- the object to marshalwriter
- the writer to marshal the object toXMLMarshalException
- if an error occurred during marshallingpublic void marshal(java.lang.Object object, org.xml.sax.ContentHandler contentHandler) throws XMLMarshalException
object
- the object to marshalcontentHandler
- the contentHandler which the specified object should be marshalled toXMLMarshalException
- if an error occurred during marshallingpublic void marshal(java.lang.Object object, org.xml.sax.ContentHandler contentHandler, org.xml.sax.ext.LexicalHandler lexicalHandler) throws XMLMarshalException
object
- the object to marshalcontentHandler
- the contentHandler which the specified object should be marshalled toXMLMarshalException
- if an error occurred during marshallingpublic void marshal(java.lang.Object object, org.w3c.dom.Node node) throws XMLMarshalException
object
- the object to marshalnode
- the node which the specified object should be marshalled toXMLMarshalException
- if an error occurred during marshallingpublic void marshal(java.lang.Object object, MarshalRecord marshalRecord)
object
- the object to marshalmarshalRecord
- the marshalRecord to marshal the object toprotected void marshal(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractSession session, MarshalRecord marshalRecord)
object
- the object to marshalmarshalRecord
- the marshalRecord to marshal the object topublic org.w3c.dom.Document objectToXML(java.lang.Object object) throws XMLMarshalException
object
- the object to marshalXMLMarshalException
- if an error occurred during marshallingprotected org.w3c.dom.Document objectToXML(java.lang.Object object, XMLDescriptor descriptor, boolean isXMLRoot) throws XMLMarshalException
object
- the object to marshaldescriptor
- the XMLDescriptor for the object being marshalledXMLMarshalException
- if an error occurred during marshallingprotected org.w3c.dom.Node objectToXMLNode(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractSession session, XMLDescriptor descriptor, boolean isXMLRoot) throws XMLMarshalException
XMLMarshalException
protected org.w3c.dom.Node objectToXMLNode(java.lang.Object object, org.w3c.dom.Node rootNode, org.eclipse.persistence.internal.sessions.AbstractSession session, XMLDescriptor descriptor, boolean isXMLRoot) throws XMLMarshalException
XMLMarshalException
public org.w3c.dom.Document objectToXML(java.lang.Object object, org.w3c.dom.Node parent) throws XMLMarshalException
object
- the object to marshalparent
- the node to marshal the object toXMLMarshalException
- if an error occurred during marshallingpublic org.w3c.dom.Document objectToXML(java.lang.Object object, org.w3c.dom.Node parent, DocumentPreservationPolicy docPresPolicy)
public org.w3c.dom.Document objectToXML(java.lang.Object object, XMLDescriptor descriptor, XMLRecord xmlRow, boolean isXMLRoot, DocumentPreservationPolicy docPresPolicy)
public org.w3c.dom.Document objectToXML(java.lang.Object object, org.w3c.dom.Node rootNode, XMLDescriptor descriptor, XMLRecord xmlRow, boolean isXMLRoot, DocumentPreservationPolicy docPresPolicy)
protected XMLDescriptor getDescriptor(java.lang.Object object) throws XMLMarshalException
XMLMarshalException
protected XMLDescriptor getDescriptor(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractSession session) throws XMLMarshalException
XMLMarshalException
protected XMLDescriptor getDescriptor(java.lang.Object object, boolean isXMLRoot)
protected XMLDescriptor getDescriptor(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractSession session, boolean isXMLRoot)
protected XMLDescriptor getDescriptor(XMLRoot object) throws XMLMarshalException
XMLMarshalException
protected XMLDescriptor getDescriptor(XMLRoot object, org.eclipse.persistence.internal.sessions.AbstractSession session) throws XMLMarshalException
XMLMarshalException
public void setFragment(boolean fragment)
fragment
- if this should marshal to a fragment or notpublic boolean isFragment()
public void setAttachmentMarshaller(XMLAttachmentMarshaller atm)
public XMLAttachmentMarshaller getAttachmentMarshaller()
public XMLTransformer getTransformer()
public javax.xml.validation.Schema getSchema()
public void setSchema(javax.xml.validation.Schema schema)
public XMLMarshaller clone()
clone
in class java.lang.Object
|
Oracle® Fusion Middleware Java API Reference for EclipseLink 11g Release 1 (11.1.1) E26376-01 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |