Java tutorial
//package com.java2s; import java.io.File; import javax.xml.XMLConstants; import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; import org.xml.sax.SAXException; public class Main { /** * @param schema * @return */ private static Schema parseSchema(File schema) { Schema parsedSchema = null; SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); try { parsedSchema = sf.newSchema(schema); } catch (SAXException e) { // TODO Auto-generated catch block System.out.println("Problems parsing schema " + schema.getName()); e.printStackTrace(); } return parsedSchema; } }