Here you can find the source of getSchemaFromResource(URL schemaURL)
public static Schema getSchemaFromResource(URL schemaURL) throws SAXException
//package com.java2s; //License from project: Apache License import java.net.URL; import javax.xml.XMLConstants; import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; import org.xml.sax.SAXException; public class Main { public static Schema getSchemaFromResource(URL schemaURL) throws SAXException { SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = sf.newSchema(schemaURL); return schema; }//from w ww . ja va2 s . c o m }