Java XML JAXB Unmarshaller unmarshal(String xml, Class c)

Here you can find the source of unmarshal(String xml, Class c)

Description

unmarshal

License

Apache License

Declaration

public static <T> T unmarshal(String xml, Class<T> c) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.StringReader;
import javax.xml.bind.DataBindingException;
import javax.xml.bind.JAXB;

public class Main {
    public static <T> T unmarshal(String xml, Class<T> c) {
        StringReader sr = null;//from  w  w  w  . ja  va2 s . c o  m
        try {
            sr = new StringReader(xml.toString());
            return JAXB.unmarshal(sr, c);
        } catch (DataBindingException e) {
            e.printStackTrace();
            return null;
        } finally {
            sr.close();
        }
    }
}

Related

  1. unmarshal(String content, Class clasz)
  2. unMarshal(String contextPath, InputStream xmlStream)
  3. unmarshal(String ObjXml, Class configurationClass)
  4. unmarshal(String packageName, InputStream inputStream)
  5. unmarshal(String string, Class clazz)
  6. unmarshal(String xml, Class clazz)
  7. unmarshal(String xml, Class clazz)
  8. unmarshal(T entity)
  9. unmarshalByContent(Class clazz, String xmlContent)