Package org.eclipse.persistence.oxm
Class XMLUnmarshaller
- java.lang.Object
-
- org.eclipse.persistence.internal.oxm.Unmarshaller<ABSTRACT_SESSION,CONTEXT,DESCRIPTOR,ID_RESOLVER,MEDIA_TYPE,ROOT,UNMARSHALLER_HANDLER,UNMARSHALLER_LISTENER>
-
- org.eclipse.persistence.internal.oxm.XMLUnmarshaller<org.eclipse.persistence.internal.sessions.AbstractSession,XMLContext,XMLDescriptor,IDResolver,MediaType,XMLRoot,XMLUnmarshallerHandler,XMLUnmarshalListener>
-
- org.eclipse.persistence.oxm.XMLUnmarshaller
-
- All Implemented Interfaces:
java.lang.Cloneable
public class XMLUnmarshaller extends org.eclipse.persistence.internal.oxm.XMLUnmarshaller<org.eclipse.persistence.internal.sessions.AbstractSession,XMLContext,XMLDescriptor,IDResolver,MediaType,XMLRoot,XMLUnmarshallerHandler,XMLUnmarshalListener> implements java.lang.Cloneable
Class used to unmarshal XML & JSON to objects.
Create an XMLUnmarshaller from an XMLContext.
Code Sample
XMLContext context = new XMLContext("mySessionName");
XMLUnmarshaller unmarshaller = context.createUnmarshaller();
XML can be unmarshalled from the following inputs:
- java.io.File
- java.io.InputStream
- java.io.Reader
- java.net.URL
- javax.xml.transform.Source
- org.w3c.dom.Node
- org.xml.sax.InputSource
XML that can be unmarshalled is XML which has a root tag that corresponds to a default root element on an XMLDescriptor in the TopLink project associated with the XMLContext.
- See Also:
XMLContext
-
-
Field Summary
Fields Modifier and Type Field Description static int
DTD_VALIDATION
static int
NONVALIDATING
static int
SCHEMA_VALIDATION
-
Constructor Summary
Constructors Modifier Constructor Description protected
XMLUnmarshaller(XMLContext xmlContext)
protected
XMLUnmarshaller(XMLContext xmlContext, java.util.Map<java.lang.String,java.lang.Boolean> parserFeatures)
protected
XMLUnmarshaller(XMLUnmarshaller xmlUnmarshaller)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description XMLUnmarshaller
clone()
XMLRoot
createRoot()
INTERNALorg.eclipse.persistence.internal.oxm.record.UnmarshalRecord
createUnmarshalRecord(XMLDescriptor xmlDescriptor, org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNALIDResolver
getIDResolver()
Return this Unmarshaller's custom IDResolver.MediaType
getMediaType()
Get the MediaType for this xmlUnmarshaller.XMLUnmarshallerHandler
getUnmarshallerHandler()
XMLUnmarshalListener
getUnmarshalListener()
XMLContext
getXMLContext()
Return the instance of XMLContext that was used to create this instance of XMLUnmarshaller.protected void
initialize(java.util.Map<java.lang.String,java.lang.Boolean> parserFeatures)
void
setIDResolver(IDResolver idResolver)
Set this Unmarshaller's custom IDResolver.void
setMediaType(MediaType mediaType)
Set the MediaType for this xmlUnmarshaller.void
setUnmarshalListener(XMLUnmarshalListener listener)
void
setValidationMode(int validationMode)
Set the validation mode.void
setXMLContext(XMLContext value)
Set the XMLContext used by this instance of XMLUnmarshaller.-
Methods inherited from class org.eclipse.persistence.internal.oxm.XMLUnmarshaller
createRootUnmarshalRecord, getAttachmentUnmarshaller, getAttributePrefix, getEntityResolver, getErrorHandler, getJsonTypeConfiguration, getNamespaceResolver, getNamespaceSeparator, getProperties, getProperty, getSchema, getStringBuffer, getUnmappedContentHandlerClass, getUnmarshalAttributeGroup, getValidationMode, getValueWrapper, isApplicationJSON, isApplicationXML, isAutoDetectMediaType, isCaseInsensitive, isIncludeRoot, isLogPayload, isResultAlwaysXMLRoot, isSecureProcessingDisabled, isWrapperAsCollectionName, setAttachmentUnmarshaller, setAttributePrefix, setAutoDetectMediaType, setCaseInsensitive, setDisableSecureProcessing, setEntityResolver, setErrorHandler, setIncludeRoot, setLogPayload, setNamespaceResolver, setNamespaceSeparator, setResultAlwaysXMLRoot, setSchema, setUnmappedContentHandlerClass, setUnmarshalAttributeGroup, setValueWrapper, setWarnOnUnmappedElement, setWrapperAsCollectionName, shouldWarnOnUnmappedElement, unmarshal, unmarshal, unmarshal, unmarshal, unmarshal, unmarshal, unmarshal, unmarshal, unmarshal, unmarshal, unmarshal, unmarshal, unmarshal, unmarshal, unmarshal, unmarshal
-
-
-
-
Field Detail
-
NONVALIDATING
public static final int NONVALIDATING
- See Also:
- Constant Field Values
-
SCHEMA_VALIDATION
public static final int SCHEMA_VALIDATION
- See Also:
- Constant Field Values
-
DTD_VALIDATION
public static final int DTD_VALIDATION
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
XMLUnmarshaller
protected XMLUnmarshaller(XMLContext xmlContext)
-
XMLUnmarshaller
protected XMLUnmarshaller(XMLContext xmlContext, java.util.Map<java.lang.String,java.lang.Boolean> parserFeatures)
-
XMLUnmarshaller
protected XMLUnmarshaller(XMLUnmarshaller xmlUnmarshaller)
-
-
Method Detail
-
clone
public XMLUnmarshaller clone()
- Overrides:
clone
in classorg.eclipse.persistence.internal.oxm.XMLUnmarshaller<org.eclipse.persistence.internal.sessions.AbstractSession,XMLContext,XMLDescriptor,IDResolver,MediaType,XMLRoot,XMLUnmarshallerHandler,XMLUnmarshalListener>
-
createRoot
public XMLRoot createRoot()
INTERNAL- Overrides:
createRoot
in classorg.eclipse.persistence.internal.oxm.XMLUnmarshaller<org.eclipse.persistence.internal.sessions.AbstractSession,XMLContext,XMLDescriptor,IDResolver,MediaType,XMLRoot,XMLUnmarshallerHandler,XMLUnmarshalListener>
- Since:
- 2.5.0
-
createUnmarshalRecord
public org.eclipse.persistence.internal.oxm.record.UnmarshalRecord createUnmarshalRecord(XMLDescriptor xmlDescriptor, org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL- Overrides:
createUnmarshalRecord
in classorg.eclipse.persistence.internal.oxm.XMLUnmarshaller<org.eclipse.persistence.internal.sessions.AbstractSession,XMLContext,XMLDescriptor,IDResolver,MediaType,XMLRoot,XMLUnmarshallerHandler,XMLUnmarshalListener>
- Since:
- 2.5.0
-
getMediaType
public MediaType getMediaType()
Get the MediaType for this xmlUnmarshaller. 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 classorg.eclipse.persistence.internal.oxm.XMLUnmarshaller<org.eclipse.persistence.internal.sessions.AbstractSession,XMLContext,XMLDescriptor,IDResolver,MediaType,XMLRoot,XMLUnmarshallerHandler,XMLUnmarshalListener>
- Returns:
- MediaType
- Since:
- 2.4
-
getUnmarshalListener
public XMLUnmarshalListener getUnmarshalListener()
- Overrides:
getUnmarshalListener
in classorg.eclipse.persistence.internal.oxm.Unmarshaller<org.eclipse.persistence.internal.sessions.AbstractSession,XMLContext,XMLDescriptor,IDResolver,MediaType,XMLRoot,XMLUnmarshallerHandler,XMLUnmarshalListener>
-
setUnmarshalListener
public void setUnmarshalListener(XMLUnmarshalListener listener)
- Overrides:
setUnmarshalListener
in classorg.eclipse.persistence.internal.oxm.Unmarshaller<org.eclipse.persistence.internal.sessions.AbstractSession,XMLContext,XMLDescriptor,IDResolver,MediaType,XMLRoot,XMLUnmarshallerHandler,XMLUnmarshalListener>
-
getUnmarshallerHandler
public XMLUnmarshallerHandler getUnmarshallerHandler()
- Overrides:
getUnmarshallerHandler
in classorg.eclipse.persistence.internal.oxm.XMLUnmarshaller<org.eclipse.persistence.internal.sessions.AbstractSession,XMLContext,XMLDescriptor,IDResolver,MediaType,XMLRoot,XMLUnmarshallerHandler,XMLUnmarshalListener>
-
getXMLContext
public XMLContext getXMLContext()
Return the instance of XMLContext that was used to create this instance of XMLUnmarshaller.- Overrides:
getXMLContext
in classorg.eclipse.persistence.internal.oxm.XMLUnmarshaller<org.eclipse.persistence.internal.sessions.AbstractSession,XMLContext,XMLDescriptor,IDResolver,MediaType,XMLRoot,XMLUnmarshallerHandler,XMLUnmarshalListener>
-
setMediaType
public void setMediaType(MediaType mediaType)
Set the MediaType for this xmlUnmarshaller. See org.eclipse.persistence.oxm.MediaType for the media types supported by EclipseLink MOXy- Overrides:
setMediaType
in classorg.eclipse.persistence.internal.oxm.XMLUnmarshaller<org.eclipse.persistence.internal.sessions.AbstractSession,XMLContext,XMLDescriptor,IDResolver,MediaType,XMLRoot,XMLUnmarshallerHandler,XMLUnmarshalListener>
- Parameters:
mediaType
-- Since:
- 2.4
-
setValidationMode
public void setValidationMode(int validationMode)
Set the validation mode. This method sets the validation mode of the parser to one of the 3 types: NONVALIDATING, DTD_VALIDATION and SCHEMA_VALIDATION. By default, the unmarshaller is set to be NONVALIDATING- Parameters:
validationMode
- sets the type of the validation mode to be used
-
setXMLContext
public void setXMLContext(XMLContext value)
Set the XMLContext used by this instance of XMLUnmarshaller.- Overrides:
setXMLContext
in classorg.eclipse.persistence.internal.oxm.XMLUnmarshaller<org.eclipse.persistence.internal.sessions.AbstractSession,XMLContext,XMLDescriptor,IDResolver,MediaType,XMLRoot,XMLUnmarshallerHandler,XMLUnmarshalListener>
-
getIDResolver
public IDResolver getIDResolver()
Return this Unmarshaller's custom IDResolver.- Overrides:
getIDResolver
in classorg.eclipse.persistence.internal.oxm.XMLUnmarshaller<org.eclipse.persistence.internal.sessions.AbstractSession,XMLContext,XMLDescriptor,IDResolver,MediaType,XMLRoot,XMLUnmarshallerHandler,XMLUnmarshalListener>
- Returns:
- the custom IDResolver, or null if one has not been specified.
- See Also:
IDResolver
- Since:
- 2.3.3
-
setIDResolver
public void setIDResolver(IDResolver idResolver)
Set this Unmarshaller's custom IDResolver.- Overrides:
setIDResolver
in classorg.eclipse.persistence.internal.oxm.XMLUnmarshaller<org.eclipse.persistence.internal.sessions.AbstractSession,XMLContext,XMLDescriptor,IDResolver,MediaType,XMLRoot,XMLUnmarshallerHandler,XMLUnmarshalListener>
- See Also:
IDResolver
- Since:
- 2.3.3
-
initialize
protected void initialize(java.util.Map<java.lang.String,java.lang.Boolean> parserFeatures)
- Overrides:
initialize
in classorg.eclipse.persistence.internal.oxm.XMLUnmarshaller<org.eclipse.persistence.internal.sessions.AbstractSession,XMLContext,XMLDescriptor,IDResolver,MediaType,XMLRoot,XMLUnmarshallerHandler,XMLUnmarshalListener>
-
-