SAX error if StreamSource(FileInputStream) but StreamSource(File) ok
Hi, I encountered a StreamSource issue when the parameter was FileInputStream. When the parameter was File, it's ok.
public int initXSD (String xsdFile) {
// no error at all if File
Source schemaFile = new StreamSource(new File(xsdFile));
// sax error at newSchema() if FileInputStream
Source schemaFile = new StreamSource( new FileInputStream(new File(xsdFile)));
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = factory.newSchema(schemaFile);
validator = schema.newValidator();
return 0;
}
as soon as i changed the StreamSource line to take a FileInputStream:
Source schemaFile = new StreamSource( new FileInputStream(new File(xsdFile)));
I got a sax error at newSchema():
org.xml.sax.SAXParseException: src-resolve: Cannot resolve the name 's:ComplexObjectType' to a(n) 'type definition' component.