Top Description Fields Constructors Methods
jakarta.xml.bind.helpers

public abstract Class AbstractUnmarshallerImpl

extends Object
implements Unmarshaller
Class Inheritance
All Implemented Interfaces
jakarta.xml.bind.Unmarshaller
Imports
org.xml.sax.InputSource, .SAXException, .XMLReader, org.w3c.dom.Node, jakarta.xml.bind.JAXBException, .PropertyException, .UnmarshalException, .Unmarshaller, .ValidationEventHandler, .JAXBElement, jakarta.xml.bind.annotation.adapters.XmlAdapter, jakarta.xml.bind.attachment.AttachmentUnmarshaller, java.io.BufferedInputStream, .File, .FileInputStream, .FileNotFoundException, .Reader, javax.xml.parsers.ParserConfigurationException, .SAXParserFactory, javax.xml.stream.XMLEventReader, .XMLStreamReader, javax.xml.transform.Source, javax.xml.transform.dom.DOMSource, javax.xml.transform.sax.SAXSource, javax.xml.transform.stream.StreamSource, javax.xml.validation.Schema, java.net.URL

Partial default Unmarshaller implementation.

This class provides a partial default implementation for the jakarta.xml.bind.Unmarshallerinterface.

A Jakarta XML Binding Provider has to implement five methods (getUnmarshallerHandler, unmarshal(Node), unmarshal(XMLReader,InputSource), unmarshal(XMLStreamReader), and unmarshal(XMLEventReader).

Author
Since
1.6, JAXB 1.0
See Also
jakarta.xml.bind.Unmarshaller

Field Summary

Modifier and TypeField and Description
private ValidationEventHandler
eventHandler

handler that will be used to process errors and warnings during unmarshal

private XMLReader
reader

XMLReader that will be used to parse a document.

Constructor Summary

AccessConstructor and Description
protected
AbstractUnmarshallerImpl()

Do-nothing constructor for the derived classes.

Method Summary

Modifier and TypeMethod and Description
protected UnmarshalException

Returns:

the resulting UnmarshalException
createUnmarshalException
(SAXException e)

Creates an UnmarshalException from a SAXException.

public <A extends XmlAdapter<?, ?>> A
getAdapter(Class<A>
The type of the adapter. The specified instance will be used when jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter#value() refers to this type.
type
)

Implements jakarta.xml.bind.Unmarshaller.getAdapter.

Gets the adapter associated with the specified type.
public AttachmentUnmarshaller
public ValidationEventHandler

Returns:

the current ValidationEventHandler or the default event handler if it hasn't been set
getEventHandler
()

Implements jakarta.xml.bind.Unmarshaller.getEventHandler.

Return the current event handler or the default event handler if one hasn't been set.
public Unmarshaller.Listener
public Object
getProperty(String
the name of the property to retrieve
name
)

Implements jakarta.xml.bind.Unmarshaller.getProperty.

Default implementation of the getProperty method always throws PropertyException since there are no required properties.
public Schema
getSchema()

Implements jakarta.xml.bind.Unmarshaller.getSchema.

Get the JAXP Schema object being used to perform unmarshal-time validation.
protected XMLReader
getXMLReader()

Obtains a configured XMLReader.

public <A extends XmlAdapter<?, ?>> void
setAdapter(A
the configured instance of XmlAdapter
adapter
)

Implements jakarta.xml.bind.Unmarshaller.setAdapter.

Associates a configured instance of XmlAdapter with this unmarshaller.
public <A extends XmlAdapter<?, ?>> void
setAdapter(Class<A>
The type of the adapter. The specified instance will be used when jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter#value() refers to this type.
type
,
A
The instance of the adapter to be used. If null, it will un-register the current adapter set for this type.
adapter
)

Implements jakarta.xml.bind.Unmarshaller.setAdapter.

Associates a configured instance of XmlAdapter with this unmarshaller.
public void
setAttachmentUnmarshaller(AttachmentUnmarshaller
the attachment unmarshaller to be set
au
)

Implements jakarta.xml.bind.Unmarshaller.setAttachmentUnmarshaller.

Associate a context that resolves cid's, content-id URIs, to binary data passed as attachments.
public void
setEventHandler(ValidationEventHandler
the validation event handler
handler
)

Implements jakarta.xml.bind.Unmarshaller.setEventHandler.

Allow an application to register a validation event handler.
public void
setListener(Unmarshaller.Listener
provides unmarshal event callbacks for this Unmarshaller
listener
)

Implements jakarta.xml.bind.Unmarshaller.setListener.

Register unmarshal event callback Listener with this Unmarshaller.

public void
setProperty(String
the name of the property to be set. This value can either be specified using one of the constant fields or a user supplied string.
name
,
Object
the value of the property to be set
value
)

Implements jakarta.xml.bind.Unmarshaller.setProperty.

Default implementation of the setProperty method always throws PropertyException since there are no required properties.
public void
setSchema(Schema
Schema object to validate unmarshal operations against or null to disable validation
schema
)

Implements jakarta.xml.bind.Unmarshaller.setSchema.

Specify the JAXP Schema object that should be used to validate subsequent unmarshal operations against.
private static InputSource
public Object
unmarshal(Source
the XML Source to unmarshal XML data from (providers are only required to support SAXSource, DOMSource, and StreamSource)
source
)

Implements jakarta.xml.bind.Unmarshaller.unmarshal.

Unmarshal XML data from the specified XML Source and return the resulting content tree.
private Object
protected abstract Object
unmarshal(XMLReader reader, InputSource source)

Unmarshals an object by using the specified XMLReader and the InputSource.

public final Object
unmarshal(InputSource
the input source to unmarshal XML data from
source
)

Implements jakarta.xml.bind.Unmarshaller.unmarshal.

Unmarshal XML data from the specified SAX InputSource and return the resulting content tree.
private Object
public final Object
unmarshal(URL
the url to unmarshal XML data from
url
)

Implements jakarta.xml.bind.Unmarshaller.unmarshal.

Unmarshal XML data from the specified URL and return the resulting content tree.
public final Object
unmarshal(File
the file to unmarshal XML data from
f
)

Implements jakarta.xml.bind.Unmarshaller.unmarshal.

Unmarshal XML data from the specified file and return the resulting content tree.
public final Object
unmarshal(InputStream
the InputStream to unmarshal XML data from
is
)

Implements jakarta.xml.bind.Unmarshaller.unmarshal.

Unmarshal XML data from the specified InputStream and return the resulting content tree.
public final Object
unmarshal(Reader
the Reader to unmarshal XML data from
reader
)

Implements jakarta.xml.bind.Unmarshaller.unmarshal.

Unmarshal XML data from the specified Reader and return the resulting content tree.
public Object
unmarshal(XMLEventReader
The parser to be read.
reader
)

Implements jakarta.xml.bind.Unmarshaller.unmarshal.

Unmarshal XML data from the specified pull parser and return the resulting content tree.
public Object
unmarshal(XMLStreamReader
The parser to be read.
reader
)

Implements jakarta.xml.bind.Unmarshaller.unmarshal.

Unmarshal XML data from the specified pull parser and return the resulting content tree.
public <T> JAXBElement<T>
unmarshal(Node
the document/element to unmarshal XML data from. The caller must support at least Document and Element.
node
,
Class<T>
appropriate Jakarta XML Binding mapped class to hold node's XML data.
expectedType
)

Implements jakarta.xml.bind.Unmarshaller.unmarshal.

Unmarshal XML data by Jakarta XML Binding mapped declaredType and return the resulting content tree.
public <T> JAXBElement<T>
unmarshal(Source
the XML Source to unmarshal XML data from (providers are only required to support SAXSource, DOMSource, and StreamSource)
source
,
Class<T>
appropriate Jakarta XML Binding mapped class to hold source's xml root element
expectedType
)

Implements jakarta.xml.bind.Unmarshaller.unmarshal.

Unmarshal XML data from the specified XML Source by declaredType and return the resulting content tree.
public <T> JAXBElement<T>
unmarshal(XMLStreamReader
The parser to be read.
reader
,
Class<T>
appropriate Jakarta XML Binding mapped class to hold reader's START_ELEMENT XML data.
expectedType
)

Implements jakarta.xml.bind.Unmarshaller.unmarshal.

Unmarshal root element to Jakarta XML Binding mapped declaredType and return the resulting content tree.
public <T> JAXBElement<T>
unmarshal(XMLEventReader
The parser to be read.
reader
,
Class<T>
appropriate Jakarta XML Binding mapped class to hold reader's START_ELEMENT XML data.
expectedType
)

Implements jakarta.xml.bind.Unmarshaller.unmarshal.

Unmarshal root element to Jakarta XML Binding mapped declaredType and return the resulting content tree.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

eventHandlerback to summary
private ValidationEventHandler eventHandler

handler that will be used to process errors and warnings during unmarshal

readerback to summary
private XMLReader reader

XMLReader that will be used to parse a document.

Constructor Detail

AbstractUnmarshallerImplback to summary
protected AbstractUnmarshallerImpl()

Do-nothing constructor for the derived classes.

Method Detail

createUnmarshalExceptionback to summary
protected UnmarshalException createUnmarshalException(SAXException e)

Creates an UnmarshalException from a SAXException. This is an utility method provided for the derived classes.

When a provider-implemented ContentHandler wants to throw a JAXBException, it needs to wrap the exception by a SAXException. If the unmarshaller implementation blindly wrap SAXException by JAXBException, such an exception will be a JAXBException wrapped by a SAXException wrapped by another JAXBException. This is silly.

This method checks the nested exception of SAXException and reduce those excessive wrapping.

Returns:UnmarshalException

the resulting UnmarshalException

getAdapterback to summary
public <A extends XmlAdapter<?, ?>> A getAdapter(Class<A> type)

Implements jakarta.xml.bind.Unmarshaller.getAdapter.

Doc from jakarta.xml.bind.Unmarshaller.getAdapter.

Gets the adapter associated with the specified type. This is the reverse operation of the setAdapter method.

Parameters
<A>
the type of the adapter
type:Class<A>

The type of the adapter. The specified instance will be used when jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter#value() refers to this type.

Returns:A

The adapter associated with the specified type.

Annotations
@Override
getAttachmentUnmarshallerback to summary
public AttachmentUnmarshaller getAttachmentUnmarshaller()

Implements jakarta.xml.bind.Unmarshaller.getAttachmentUnmarshaller.

Annotations
@Override
getEventHandlerback to summary
public ValidationEventHandler getEventHandler() throws JAXBException

Implements jakarta.xml.bind.Unmarshaller.getEventHandler.

Return the current event handler or the default event handler if one hasn't been set.

Returns:ValidationEventHandler

the current ValidationEventHandler or the default event handler if it hasn't been set

Annotations
@Override
Exceptions
JAXBException:
if an error was encountered while getting the current event handler
getListenerback to summary
public Unmarshaller.Listener getListener()

Implements jakarta.xml.bind.Unmarshaller.getListener.

Doc from jakarta.xml.bind.Unmarshaller.getListener.

Return Listener registered with this Unmarshaller.

Returns:Unmarshaller.Listener

registered Listener or null if no Listener is registered with this Unmarshaller.

Annotations
@Override
getPropertyback to summary
public Object getProperty(String name) throws PropertyException

Implements jakarta.xml.bind.Unmarshaller.getProperty.

Default implementation of the getProperty method always throws PropertyException since there are no required properties. If a provider needs to handle additional properties, it should override this method in a derived class.

Parameters
name:String

Doc from jakarta.xml.bind.Unmarshaller.getProperty.

the name of the property to retrieve

Returns:Object

Doc from jakarta.xml.bind.Unmarshaller.getProperty.

the value of the requested property

Annotations
@Override
Exceptions
PropertyException:

Doc from jakarta.xml.bind.Unmarshaller.getProperty.

when there is an error retrieving the given property or value property name

getSchemaback to summary
public Schema getSchema()

Implements jakarta.xml.bind.Unmarshaller.getSchema.

Doc from jakarta.xml.bind.Unmarshaller.getSchema.

Get the JAXP Schema object being used to perform unmarshal-time validation. If there is no Schema set on the unmarshaller, then this method will return null indicating that unmarshal-time validation will not be performed.

Returns:Schema

the Schema object being used to perform unmarshal-time validation or null if not present

Annotations
@Override
getXMLReaderback to summary
protected XMLReader getXMLReader() throws JAXBException

Obtains a configured XMLReader. This method is used when the client-specified SAXSource object doesn't have XMLReader. Unmarshaller is not re-entrant, so we will only use one instance of XMLReader.

setAdapterback to summary
public <A extends XmlAdapter<?, ?>> void setAdapter(A adapter)

Implements jakarta.xml.bind.Unmarshaller.setAdapter.

Doc from jakarta.xml.bind.Unmarshaller.setAdapter.

Associates a configured instance of XmlAdapter with this unmarshaller.

This is a convenience method that invokes setAdapter(adapter.getClass(),adapter);.

Parameters
<A>
the type of XmlAdapter
adapter:A

the configured instance of XmlAdapter

Annotations
@Override
@SuppressWarnings:unchecked
setAdapterback to summary
public <A extends XmlAdapter<?, ?>> void setAdapter(Class<A> type, A adapter)

Implements jakarta.xml.bind.Unmarshaller.setAdapter.

Doc from jakarta.xml.bind.Unmarshaller.setAdapter.

Associates a configured instance of XmlAdapter with this unmarshaller.

Every unmarshaller internally maintains a java.util.Map<Class,XmlAdapter>, which it uses for unmarshalling classes whose fields/methods are annotated with jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter.

This method allows applications to use a configured instance of XmlAdapter. When an instance of an adapter is not given, an unmarshaller will create one by invoking its default constructor.

Parameters
<A>
the type of the adapter
type:Class<A>

The type of the adapter. The specified instance will be used when jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter#value() refers to this type.

adapter:A

The instance of the adapter to be used. If null, it will un-register the current adapter set for this type.

Annotations
@Override
setAttachmentUnmarshallerback to summary
public void setAttachmentUnmarshaller(AttachmentUnmarshaller au)

Implements jakarta.xml.bind.Unmarshaller.setAttachmentUnmarshaller.

Doc from jakarta.xml.bind.Unmarshaller.setAttachmentUnmarshaller.

Associate a context that resolves cid's, content-id URIs, to binary data passed as attachments. Unmarshal time validation, enabled via setSchema(Schema), must be supported even when unmarshaller is performing XOP processing.

Parameters
au:AttachmentUnmarshaller

the attachment unmarshaller to be set

Annotations
@Override
setEventHandlerback to summary
public void setEventHandler(ValidationEventHandler handler) throws JAXBException

Implements jakarta.xml.bind.Unmarshaller.setEventHandler.

Allow an application to register a validation event handler.

The validation event handler will be called by the Jakarta XML Binding Provider if any validation errors are encountered during calls to any of the unmarshal methods. If the client application does not register a validation event handler before invoking the unmarshal methods, then all validation events will be silently ignored and may result in unexpected behaviour.

Parameters
handler:ValidationEventHandler

the validation event handler

Annotations
@Override
Exceptions
JAXBException:
if an error was encountered while setting the event handler
setListenerback to summary
public void setListener(Unmarshaller.Listener listener)

Implements jakarta.xml.bind.Unmarshaller.setListener.

Doc from jakarta.xml.bind.Unmarshaller.setListener.

Register unmarshal event callback Listener with this Unmarshaller.

There is only one Listener per Unmarshaller. Setting a Listener replaces the previous set Listener. One can unregister current Listener by setting listener to null.

Parameters
listener:Unmarshaller.Listener

provides unmarshal event callbacks for this Unmarshaller

Annotations
@Override
setPropertyback to summary
public void setProperty(String name, Object value) throws PropertyException

Implements jakarta.xml.bind.Unmarshaller.setProperty.

Default implementation of the setProperty method always throws PropertyException since there are no required properties. If a provider needs to handle additional properties, it should override this method in a derived class.

Parameters
name:String

Doc from jakarta.xml.bind.Unmarshaller.setProperty.

the name of the property to be set. This value can either be specified using one of the constant fields or a user supplied string.

value:Object

Doc from jakarta.xml.bind.Unmarshaller.setProperty.

the value of the property to be set

Annotations
@Override
Exceptions
PropertyException:

Doc from jakarta.xml.bind.Unmarshaller.setProperty.

when there is an error processing the given property or value

setSchemaback to summary
public void setSchema(Schema schema)

Implements jakarta.xml.bind.Unmarshaller.setSchema.

Doc from jakarta.xml.bind.Unmarshaller.setSchema.

Specify the JAXP Schema object that should be used to validate subsequent unmarshal operations against. Passing null into this method will disable validation.

Initially this property is set to null.

Parameters
schema:Schema

Schema object to validate unmarshal operations against or null to disable validation

Annotations
@Override
streamSourceToInputSourceback to summary
private static InputSource streamSourceToInputSource(StreamSource ss)
unmarshalback to summary
public Object unmarshal(Source source) throws JAXBException

Implements jakarta.xml.bind.Unmarshaller.unmarshal.

Doc from jakarta.xml.bind.Unmarshaller.unmarshal.

Unmarshal XML data from the specified XML Source and return the resulting content tree.

Implements Unmarshal Global Root Element.

SAX 2.0 Parser Pluggability

A client application can choose not to use the default parser mechanism supplied with their Jakarta XML Binding provider. Any SAX 2.0 compliant parser can be substituted for the Jakarta XML Binding provider's default mechanism. To do so, the client application must properly configure a SAXSource containing an XMLReader implemented by the SAX 2.0 parser provider. If the XMLReader has an org.xml.sax.ErrorHandler registered on it, it will be replaced by the Jakarta XML Binding Provider so that validation errors can be reported via the ValidationEventHandler mechanism of Jakarta XML Binding. If the SAXSource does not contain an XMLReader, then the Jakarta XML Binding provider's default parser mechanism will be used.

This parser replacement mechanism can also be used to replace the Jakarta XML Binding provider's unmarshal-time validation engine. The client application must properly configure their SAX 2.0 compliant parser to perform validation (as shown in the example above). Any SAXParserExceptions encountered by the parser during the unmarshal operation will be processed by the Jakarta XML Binding provider and converted into Jakarta XML Binding ValidationEvent objects which will be reported back to the client via the ValidationEventHandler registered with the Unmarshaller

Note

specifying a substitute validating SAX 2.0 parser for unmarshalling does not necessarily replace the validation engine used by the Jakarta XML Binding provider for performing on-demand validation.

The only way for a client application to specify an alternate parser mechanism to be used during unmarshal is via the unmarshal(SAXSource) API. All other forms of the unmarshal method (File, URL, Node, etc) will use the Jakarta XML Binding provider's default parser and validator mechanisms.

Parameters
source:Source

the XML Source to unmarshal XML data from (providers are only required to support SAXSource, DOMSource, and StreamSource)

Returns:Object

the newly created root object of the java content tree

Annotations
@Override
Exceptions
JAXBException:
If any unexpected errors occur while unmarshalling
unmarshalback to summary
private Object unmarshal(SAXSource source) throws JAXBException
unmarshalback to summary
protected abstract Object unmarshal(XMLReader reader, InputSource source) throws JAXBException

Unmarshals an object by using the specified XMLReader and the InputSource. The callee should call the setErrorHandler method of the XMLReader so that errors are passed to the client-specified ValidationEventHandler.

unmarshalback to summary
public final Object unmarshal(InputSource source) throws JAXBException

Implements jakarta.xml.bind.Unmarshaller.unmarshal.

Doc from jakarta.xml.bind.Unmarshaller.unmarshal.

Unmarshal XML data from the specified SAX InputSource and return the resulting content tree.

Implements Unmarshal Global Root Element.

Parameters
source:InputSource

the input source to unmarshal XML data from

Returns:Object

the newly created root object of the java content tree

Annotations
@Override
Exceptions
JAXBException:
If any unexpected errors occur while unmarshalling
unmarshalback to summary
private Object unmarshal(String url) throws JAXBException
unmarshalback to summary
public final Object unmarshal(URL url) throws JAXBException

Implements jakarta.xml.bind.Unmarshaller.unmarshal.

Doc from jakarta.xml.bind.Unmarshaller.unmarshal.

Unmarshal XML data from the specified URL and return the resulting content tree.

Implements Unmarshal Global Root Element.

Parameters
url:URL

the url to unmarshal XML data from

Returns:Object

the newly created root object of the java content tree

Annotations
@Override
Exceptions
JAXBException:
If any unexpected errors occur while unmarshalling
unmarshalback to summary
public final Object unmarshal(File f) throws JAXBException

Implements jakarta.xml.bind.Unmarshaller.unmarshal.

Doc from jakarta.xml.bind.Unmarshaller.unmarshal.

Unmarshal XML data from the specified file and return the resulting content tree.

Implements Unmarshal Global Root Element.

Parameters
f:File

the file to unmarshal XML data from

Returns:Object

the newly created root object of the java content tree

Annotations
@Override
Exceptions
JAXBException:
If any unexpected errors occur while unmarshalling
unmarshalback to summary
public final Object unmarshal(InputStream is) throws JAXBException

Implements jakarta.xml.bind.Unmarshaller.unmarshal.

Doc from jakarta.xml.bind.Unmarshaller.unmarshal.

Unmarshal XML data from the specified InputStream and return the resulting content tree. Validation event location information may be incomplete when using this form of the unmarshal API.

Implements Unmarshal Global Root Element.

Parameters
is:InputStream

the InputStream to unmarshal XML data from

Returns:Object

the newly created root object of the java content tree

Annotations
@Override
Exceptions
JAXBException:
If any unexpected errors occur while unmarshalling
unmarshalback to summary
public final Object unmarshal(Reader reader) throws JAXBException

Implements jakarta.xml.bind.Unmarshaller.unmarshal.

Doc from jakarta.xml.bind.Unmarshaller.unmarshal.

Unmarshal XML data from the specified Reader and return the resulting content tree. Validation event location information may be incomplete when using this form of the unmarshal API, because a Reader does not provide the system ID.

Implements Unmarshal Global Root Element.

Parameters
reader:Reader

the Reader to unmarshal XML data from

Returns:Object

the newly created root object of the java content tree

Annotations
@Override
Exceptions
JAXBException:
If any unexpected errors occur while unmarshalling
unmarshalback to summary
public Object unmarshal(XMLEventReader reader) throws JAXBException

Implements jakarta.xml.bind.Unmarshaller.unmarshal.

Doc from jakarta.xml.bind.Unmarshaller.unmarshal.

Unmarshal XML data from the specified pull parser and return the resulting content tree.

This method is an Unmarshal Global Root method.

This method assumes that the parser is on a START_DOCUMENT or START_ELEMENT event. Unmarshalling will be done from this start event to the corresponding end event. If this method returns successfully, the reader will be pointing at the token right after the end event.

Parameters
reader:XMLEventReader

The parser to be read.

Returns:Object

the newly created root object of the java content tree.

Annotations
@Override
Exceptions
JAXBException:
If any unexpected errors occur while unmarshalling
unmarshalback to summary
public Object unmarshal(XMLStreamReader reader) throws JAXBException

Implements jakarta.xml.bind.Unmarshaller.unmarshal.

Doc from jakarta.xml.bind.Unmarshaller.unmarshal.

Unmarshal XML data from the specified pull parser and return the resulting content tree.

Implements Unmarshal Global Root Element.

This method assumes that the parser is on a START_DOCUMENT or START_ELEMENT event. Unmarshalling will be done from this start event to the corresponding end event. If this method returns successfully, the reader will be pointing at the token right after the end event.

Parameters
reader:XMLStreamReader

The parser to be read.

Returns:Object

the newly created root object of the java content tree.

Annotations
@Override
Exceptions
JAXBException:
If any unexpected errors occur while unmarshalling
unmarshalback to summary
public <T> JAXBElement<T> unmarshal(Node node, Class<T> expectedType) throws JAXBException

Implements jakarta.xml.bind.Unmarshaller.unmarshal.

Doc from jakarta.xml.bind.Unmarshaller.unmarshal.

Unmarshal XML data by Jakarta XML Binding mapped declaredType and return the resulting content tree.

Implements Unmarshal by Declared Type

Parameters
<T>
the XML Binding mapped class
node:Node

the document/element to unmarshal XML data from. The caller must support at least Document and Element.

expectedType:Class<T>

appropriate Jakarta XML Binding mapped class to hold node's XML data.

Returns:JAXBElement<T>

JAXBElement representation of node

Annotations
@Override
Exceptions
JAXBException:
If any unexpected errors occur while unmarshalling
unmarshalback to summary
public <T> JAXBElement<T> unmarshal(Source source, Class<T> expectedType) throws JAXBException

Implements jakarta.xml.bind.Unmarshaller.unmarshal.

Doc from jakarta.xml.bind.Unmarshaller.unmarshal.

Unmarshal XML data from the specified XML Source by declaredType and return the resulting content tree.

Implements Unmarshal by Declared Type

See SAX 2.0 Parser Pluggability

Parameters
<T>
the XML Binding mapped class
source:Source

the XML Source to unmarshal XML data from (providers are only required to support SAXSource, DOMSource, and StreamSource)

expectedType:Class<T>

appropriate Jakarta XML Binding mapped class to hold source's xml root element

Returns:JAXBElement<T>

Java content rooted by JAXBElement

Annotations
@Override
Exceptions
JAXBException:
If any unexpected errors occur while unmarshalling
unmarshalback to summary
public <T> JAXBElement<T> unmarshal(XMLStreamReader reader, Class<T> expectedType) throws JAXBException

Implements jakarta.xml.bind.Unmarshaller.unmarshal.

Doc from jakarta.xml.bind.Unmarshaller.unmarshal.

Unmarshal root element to Jakarta XML Binding mapped declaredType and return the resulting content tree.

This method implements unmarshal by declaredType.

This method assumes that the parser is on a START_DOCUMENT or START_ELEMENT event. Unmarshalling will be done from this start event to the corresponding end event. If this method returns successfully, the reader will be pointing at the token right after the end event.

Parameters
<T>
the XML Binding mapped class
reader:XMLStreamReader

The parser to be read.

expectedType:Class<T>

appropriate Jakarta XML Binding mapped class to hold reader's START_ELEMENT XML data.

Returns:JAXBElement<T>

content tree rooted by JAXBElement representation

Annotations
@Override
Exceptions
JAXBException:
If any unexpected errors occur while unmarshalling
unmarshalback to summary
public <T> JAXBElement<T> unmarshal(XMLEventReader reader, Class<T> expectedType) throws JAXBException

Implements jakarta.xml.bind.Unmarshaller.unmarshal.

Doc from jakarta.xml.bind.Unmarshaller.unmarshal.

Unmarshal root element to Jakarta XML Binding mapped declaredType and return the resulting content tree.

This method implements unmarshal by declaredType.

This method assumes that the parser is on a START_DOCUMENT or START_ELEMENT event. Unmarshalling will be done from this start event to the corresponding end event. If this method returns successfully, the reader will be pointing at the token right after the end event.

Parameters
<T>
the XML Binding mapped class
reader:XMLEventReader

The parser to be read.

expectedType:Class<T>

appropriate Jakarta XML Binding mapped class to hold reader's START_ELEMENT XML data.

Returns:JAXBElement<T>

content tree rooted by JAXBElement representation

Annotations
@Override
Exceptions
JAXBException:
If any unexpected errors occur while unmarshalling