public class XMLUnmarshaller extends Object implements Cloneable
Class used to unmarshal XML to objects.
Create an XMLUnmarshaller from an XMLContext. XML can be unmarshalled from the following inputs: 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.
Code Sample
XMLContext context = new XMLContext("mySessionName");
XMLUnmarshaller unmarshaller = context.createUnmarshaller();
XMLContext
Modifier and Type | Field and Description |
---|---|
static int |
DTD_VALIDATION |
static int |
NONVALIDATING |
static int |
SCHEMA_VALIDATION |
Modifier and Type | Method and Description |
---|---|
XMLUnmarshaller |
clone() |
XMLAttachmentUnmarshaller |
getAttachmentUnmarshaller() |
EntityResolver |
getEntityResolver()
Get the EntityResolver set on this XMLUnmarshaller
|
ErrorHandler |
getErrorHandler()
Get the ErrorHandler set on this XMLUnmarshaller
|
Properties |
getProperties()
Return a properties object for a given instance of the
XMLUnmarshaller.
|
Object |
getProperty(Object key)
Return the property for a given key, if one exists.
|
Schema |
getSchema() |
org.eclipse.persistence.internal.oxm.StrBuffer |
getStringBuffer()
INTERNAL:
This is the text handler during unmarshal operations.
|
Class |
getUnmappedContentHandlerClass()
Get the class that will be instantiated to handled unmapped content
Class must implement the org.eclipse.persistence.oxm.unmapped.UnmappedContentHandler interface
|
XMLUnmarshallerHandler |
getUnmarshallerHandler() |
XMLUnmarshalListener |
getUnmarshalListener() |
int |
getValidationMode()
Get the validation mode set on this XMLUnmarshaller
By default, the unmarshaller is set to be NONVALIDATING
|
XMLContext |
getXMLContext()
Return the instance of XMLContext that was used to create this instance
of XMLUnmarshaller.
|
boolean |
isResultAlwaysXMLRoot() |
void |
resolveReferences(org.eclipse.persistence.internal.sessions.AbstractSession unitOfWork)
INTERNAL
|
void |
setAttachmentUnmarshaller(XMLAttachmentUnmarshaller atu) |
void |
setEntityResolver(EntityResolver entityResolver)
Set the EntityResolver on this XMLUnmarshaller
|
void |
setErrorHandler(ErrorHandler errorHandler)
Set the ErrorHandler on this XMLUnmarshaller
|
void |
setResultAlwaysXMLRoot(boolean alwaysReturnRoot) |
void |
setSchema(Schema schema) |
void |
setUnmappedContentHandlerClass(Class aClass)
Set the class that will be instantiated to handled unmapped content
Class must implement the org.eclipse.persistence.oxm.unmapped.UnmappedContentHandler interface
|
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.
|
Object |
unmarshal(File file)
PUBLIC:
Read and parse the XML document from the file and map the XML data into an object.
|
Object |
unmarshal(File file,
Class clazz)
PUBLIC:
Read and parse the XML document from the file and map the XML data into an object.
|
Object |
unmarshal(InputSource inputSource)
PUBLIC:
Read and parse the XML document from the inputSource and map the XML data into an object.
|
Object |
unmarshal(InputSource inputSource,
Class clazz)
PUBLIC:
Read and parse the XML document from the inputSource and map the XML data into an object.
|
Object |
unmarshal(InputStream inputStream)
PUBLIC:
Read and parse the XML document from the inputStream and map the XML data into an object.
|
Object |
unmarshal(InputStream inputStream,
Class clazz)
PUBLIC:
Read and parse the XML document from the inputStream and map the XML data into an object.
|
Object |
unmarshal(Node node)
PUBLIC:
Map the XML node into an object.
|
Object |
unmarshal(Node node,
Class clazz)
PUBLIC:
Map the XML node into an object.
|
Object |
unmarshal(Reader reader)
PUBLIC:
Read and parse the XML document from the reader and map the XML data into an object.
|
Object |
unmarshal(Reader reader,
Class clazz)
PUBLIC:
Read and parse the XML document from the reader and map the XML data into an object.
|
Object |
unmarshal(Source source)
PUBLIC:
Read and parse the XML document from the source and map the XML data into an object.
|
Object |
unmarshal(Source source,
Class clazz)
PUBLIC:
Read and parse the XML document from the source and map the XML data into an object.
|
Object |
unmarshal(URL url)
PUBLIC:
Read and parse the XML document from the url and map the XML data into an object.
|
Object |
unmarshal(URL url,
Class clazz)
PUBLIC:
Read and parse the XML document from the url and map the XML data into an object.
|
Object |
unmarshal(XMLReader xmlReader,
InputSource inputSource) |
Object |
unmarshal(XMLReader xmlReader,
InputSource inputSource,
Class clazz) |
public static final int NONVALIDATING
public static final int SCHEMA_VALIDATION
public static final int DTD_VALIDATION
public XMLContext getXMLContext()
public void setXMLContext(XMLContext value)
public int getValidationMode()
public void resolveReferences(org.eclipse.persistence.internal.sessions.AbstractSession unitOfWork)
unitOfWork
- public void setValidationMode(int validationMode)
validationMode
- sets the type of the validation mode to be usedpublic EntityResolver getEntityResolver()
public void setEntityResolver(EntityResolver entityResolver)
entityResolver
- the EntityResolver to set on this XMLUnmarshallerpublic ErrorHandler getErrorHandler()
public void setErrorHandler(ErrorHandler errorHandler)
errorHandler
- the ErrorHandler to set on this XMLUnmarshallerpublic XMLUnmarshalListener getUnmarshalListener()
public void setUnmarshalListener(XMLUnmarshalListener listener)
public Class getUnmappedContentHandlerClass()
public void setUnmappedContentHandlerClass(Class aClass)
aClass
- public org.eclipse.persistence.internal.oxm.StrBuffer getStringBuffer()
public Object unmarshal(File file) throws XMLMarshalException
file
- The file to unmarshal fromXMLMarshalException
- if an error occurred during unmarshallingpublic Object unmarshal(File file, Class clazz) throws XMLMarshalException
file
- The file to unmarshal fromclazz
- The type of object to return.XMLMarshalException
- if an error occurred during unmarshallingpublic Object unmarshal(InputStream inputStream) throws XMLMarshalException
inputStream
- The inputStream to unmarshal fromXMLMarshalException
- if an error occurred during unmarshallingpublic Object unmarshal(InputStream inputStream, Class clazz) throws XMLMarshalException
inputStream
- The inputStream to unmarshal fromclazz
- The type of object to return.XMLMarshalException
- if an error occurred during unmarshallingpublic Object unmarshal(Reader reader) throws XMLMarshalException
reader
- The reader to unmarshal fromXMLMarshalException
- if an error occurred during unmarshallingpublic Object unmarshal(Reader reader, Class clazz) throws XMLMarshalException
reader
- The reader to unmarshal fromclazz
- The type of object to return.XMLMarshalException
- if an error occurred during unmarshallingpublic Object unmarshal(URL url) throws XMLMarshalException
url
- The url to unmarshal fromXMLMarshalException
- if an error occurred during unmarshallingpublic Object unmarshal(URL url, Class clazz) throws XMLMarshalException
url
- The url to unmarshal fromclazz
- The type of object to return.XMLMarshalException
- if an error occurred during unmarshallingpublic Object unmarshal(InputSource inputSource) throws XMLMarshalException
inputSource
- The inputSource to unmarshal fromXMLMarshalException
- if an error occurred during unmarshallingpublic Object unmarshal(InputSource inputSource, Class clazz) throws XMLMarshalException
inputSource
- The inputSource to unmarshal fromclazz
- The type of object to return.XMLMarshalException
- if an error occurred during unmarshallingpublic Object unmarshal(Node node) throws XMLMarshalException
node
- The node to unmarshal fromXMLMarshalException
- if an error occurred during unmarshallingpublic Object unmarshal(Node node, Class clazz) throws XMLMarshalException
node
- The node to unmarshal fromclazz
- The type of object to return.XMLMarshalException
- if an error occurred during unmarshallingpublic Object unmarshal(Source source) throws XMLMarshalException
source
- The source to unmarshal fromXMLMarshalException
- if an error occurred during unmarshallingpublic Properties getProperties()
public Object getProperty(Object key)
public Object unmarshal(Source source, Class clazz) throws XMLMarshalException
source
- The inputSource to unmarshal fromclazz
- The type of object to return.XMLMarshalException
- if an error occurred during unmarshallingpublic Object unmarshal(XMLReader xmlReader, InputSource inputSource)
public Object unmarshal(XMLReader xmlReader, InputSource inputSource, Class clazz)
public XMLUnmarshallerHandler getUnmarshallerHandler()
public XMLAttachmentUnmarshaller getAttachmentUnmarshaller()
public void setAttachmentUnmarshaller(XMLAttachmentUnmarshaller atu)
public void setResultAlwaysXMLRoot(boolean alwaysReturnRoot)
public boolean isResultAlwaysXMLRoot()
public void setSchema(Schema schema)
public Schema getSchema()
public XMLUnmarshaller clone()