Here you can find the source of generateTemporarySchemaFile(JAXBContext context)
private static File generateTemporarySchemaFile(JAXBContext context) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.IOException; import javax.xml.bind.JAXBContext; import javax.xml.bind.SchemaOutputResolver; import javax.xml.transform.Result; import javax.xml.transform.stream.StreamResult; public class Main { private static File generateTemporarySchemaFile(JAXBContext context) throws IOException { final File tempFile = File.createTempFile( "jaxb-junit-report-schema", ".xsd"); context.generateSchema(new SchemaOutputResolver() { @Override/*w w w.jav a 2s. c om*/ public Result createOutput(String namespaceUri, String suggestedFileName) throws IOException { StreamResult result = new StreamResult(tempFile); result.setSystemId(tempFile.toURI().toURL().toString()); return result; } }); return tempFile; } }