Here you can find the source of getSchema(InputStream... inputs)
public static Schema getSchema(InputStream... inputs) throws SAXException
//package com.java2s; //License from project: Apache License import java.io.InputStream; import javax.xml.transform.stream.StreamSource; import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; import org.xml.sax.SAXException; public class Main { public static Schema getSchema(InputStream... inputs) throws SAXException { StreamSource[] streamSource = new StreamSource[inputs.length]; for (int i = 0; i < inputs.length; i++) { streamSource[i] = new StreamSource(inputs[i]); }//from w w w . ja v a 2 s . c o m SchemaFactory sf = SchemaFactory.newInstance(javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = sf.newSchema(streamSource); return schema; } }