我想使用存储在我的设备上的xsd模式文件来验证xml文档。这是我的示例代码:
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
// schema file on my device
InputStream isSchema = context.getResources().openRawResource(xsd_file);
// InputStream => Source conversion
Source schemaSource = ????
Schema schema = factory.newSchema(schemaSource);
Validator validator = schema.newValidator();
validator.validate(new DOMSource(document));
问题:如何将 InputStream 转换为 SchemaFactory::newSchema 方法所需的 Source ?