Code example for StreamSource

0
	public Schema build() {
		if (fileHandle == null)
			throw new IllegalArgumentException("FileHandle should not be null");
		SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
		try { 
			return schemaFactory.newSchema(new StreamSource(fileHandle.read()));
		} catch (SAXException e) {
			throw new RuntimeException("Failed to create Schema from fileHandle " + fileHandle, e);
		} 
	} 
 
}