Here you can find the source of unmarshall(String xml, URL schemaURL, Class... classesToBeBound)
public static Object unmarshall(String xml, URL schemaURL, Class... classesToBeBound) throws JAXBException, SAXException
//package com.java2s; //License from project: Open Source License import org.xml.sax.SAXException; import javax.xml.XMLConstants; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; import java.io.StringReader; import java.net.URL; public class Main { public static Object unmarshall(String xml, URL schemaURL, Class... classesToBeBound) throws JAXBException, SAXException { JAXBContext context = JAXBContext.newInstance(classesToBeBound); Unmarshaller unmarshaller = context.createUnmarshaller(); if (schemaURL != null) { SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = sf.newSchema(schemaURL); unmarshaller.setSchema(schema); }/*from www. jav a 2 s . c om*/ StringReader reader = new StringReader(xml); return unmarshaller.unmarshal(reader); } }