Resolution of imports via XML Catalog
In my use case I have several XSDs that import each other. However, the namespace location provided in the schemas is not accessible from the code (instead, the schemas are all resources in the class path, sometimes inside jar files, sometimes as files). Usually, this is solved by providing an XML Catalog that override the import statements. Now I don't think that this library needs to also support xml catalogs, but maybe it could be possible to somehow provide a custom lookup implementation that has a signature like public XsdSchema lookupSchema(String namespaceURL, String schemaLocation) and a Method to parse Schemas based on an InputStream public XsdSchema parse(InputStream inputStream)? This way, it should be possible to provide a lookup for imports in a fairly flexible way.
I tried to look into this, but it seems that there are quite a few dependencies on the file name in the parser core and was not able to easily refactor. So before spending some time trying to understand what would need to be changed, would you be willing to check if you think it would be feasible to attempt this and if you agree with the proposed modifications?
Hello,
The only way that I'm seeing to do that is to "pre-parse" all the required files before parsing the "original" file, because otherwise during the parsing either the file is resolved as is today or the parsed wouldn't know where to look for the file. But that doesn't make much sense.
The main issue is that sometimes the files are in jars and sometimes they are plain files, right? If that's the case the issue will probably be solved by "merging" the jar and "regular" XsdParser implementations.