Java Utililty Methods XML JAXB Unmarshaller

List of utility methods to do XML JAXB Unmarshaller

Description

The list of methods to do XML JAXB Unmarshaller are organized into topic(s).

Method

Objectunmarshal(InputStream is, Class clazz)
unmarshal
try {
    JAXBContext jaxbContext = JAXBContext.newInstance(clazz);
    Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
    Object object = unmarshaller.unmarshal(is);
    return object;
} catch (JAXBException e) {
    throw new RuntimeException("Error unmarshalling object", e);
Ounmarshal(InputStream stream, Class clazz)
Unmarshal an arbitrary object with JAXB.
return JAXB.unmarshal(stream, clazz);
Tunmarshal(JAXBContext context, Class clazz, String source)
unmarshal
if (source == null) {
    return null;
StringReader reader = new StringReader(source);
if (context == null) {
    context = JAXBContext.newInstance(clazz);
Unmarshaller un = context.createUnmarshaller();
...
Objectunmarshal(JAXBContext jaxbContext, XMLStreamReader xmlStreamReader)
unmarshal
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
return unmarshaller.unmarshal(xmlStreamReader);
Objectunmarshal(org.w3c.dom.Element elem, Class c)
unmarshal
Object result = null;
JAXBContext jc = getContext(c);
Unmarshaller um = jc.createUnmarshaller();
result = um.unmarshal(elem);
return result;
Objectunmarshal(org.w3c.dom.Element elem, Class c)
unmarshal
Object result = null;
JAXBContext jc = JAXBContext.newInstance(c);
Unmarshaller um = jc.createUnmarshaller();
result = um.unmarshal(elem);
return result;
Tunmarshal(String b, Class implClass, Class... bc)
Convert XML data to a bean using JAXB.
Class<?>[] bind;
if (bc.length > 1) {
    bind = new Class<?>[bc.length + 1];
    bind[0] = implClass;
    for (int i = 0; i < bc.length; i++) {
        bind[i + 1] = bc[i];
} else {
...
Tunmarshal(String content, Class clasz)
Unmarshal class.
JAXBContext jc = JAXBContext.newInstance(clasz);
Unmarshaller u = jc.createUnmarshaller();
Object o = null;
byte[] _res = null;
_res = content.getBytes("UTF-8");
String __str = "";
__str = new String(_res, "UTF-8");
StringBuffer xmlStr = new StringBuffer((!__str.startsWith("<") ? __str.substring(3) : __str));
...
ObjectunMarshal(String contextPath, InputStream xmlStream)
un Marshal
JAXBContext jc = JAXBContext.newInstance(contextPath);
Unmarshaller u = jc.createUnmarshaller();
return u.unmarshal(xmlStream);
Tunmarshal(String ObjXml, Class configurationClass)
unmarshal
JAXBContext bContext = JAXBContext.newInstance(configurationClass);
Unmarshaller um = bContext.createUnmarshaller();
T obj = (T) um.unmarshal(new StringReader(ObjXml));
return obj;