Here you can find the source of fromXml(@SuppressWarnings("rawtypes") Class clazz, String stringXml)
public static Object fromXml(@SuppressWarnings("rawtypes") Class clazz, String stringXml)
//package com.java2s; //License from project: Open Source License import java.io.StringReader; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; import javax.xml.transform.stream.StreamSource; public class Main { public static Object fromXml(@SuppressWarnings("rawtypes") Class clazz, String stringXml) { JAXBContext context = null; try {// w w w . j a v a 2 s . c om context = JAXBContext.newInstance(clazz); Unmarshaller unmarshaller = context.createUnmarshaller(); return unmarshaller.unmarshal(new StreamSource(new StringReader(stringXml))); } catch (JAXBException e) { e.printStackTrace(); } return null; } }