I'm trying to validate xml files against a two file schema.
Everything works fine with the following code:
Here, the ROC xsd file internally points to another file called ROC_Schema1.xsd. This second file is placed in the same folder as ROC.xsd.
So now, I want to make this code generic and accept an inputstream instead of the exact file location.
Question, how do I do that. When I try to pass the stream I get an error. Details below:
The inputstream is being created in main() as follows:
I get the following warning:
Warning:org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'ROC_Schema1.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
This naturally leads to issues during validation. I understand, that the stream doesn't contain the second xsd file. So how do I fix this?