Validate an XML against an XSD in Java / Getting a hold of the schemaLocation
How can one validate an XML file using an XSD in Java? We don't know the schema in advance. I would like to be able to get the schemaLocation , download the XSD, cache it and then perform the actual validation. The problem is, that with javax.xml.parsers.DocumentBuilder / DocumentBuilderFactory classes I can't seem to be able to get a hold of the schemaLocation in advance. What's the trick for this? Which classes should I look into? Perhaps there's a more suitable API I can use? The whole problem is that we need to validate dynamically, without (necessarily) having the XSDs locally. How could