I am generating Schema using SchemaFactory as follows
final SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
InputStream stream1 = new FileInputStream("Test1.xsd");
InputStream stream2 = new FileInputStream("Test2.xsd");
StreamSource[] sourceArray = new StreamSource[2];
sourceArray[0] = new StreamSource(stream1);
sourceArray[1] = new StreamSource(stream2);
InputStream test = new FileInputStream("requestcontroller-webapp.xml");
Source testxml = new StreamSource(test);
Schema schema = null;
schema = sf.newSchema(sourceArray);
System.out.println("Schema creation successful");
One of my xsd was having an issue which caused the above code to throw-
org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
Now the issue is not the exception itself as I could check both the xsd and fix the issue. But if the number of xsds is huge, then is there any way we can get the name of xsd which has the issue? Because the exception message does not describe it.