Can XMLCatalog be used for schema imports?
- by jon077
Can you use XMLCatalog to resolve xsds in schema import statements? If so, what is the preferred/best practice? I want to package the xsds in a jar, so using a relative schemaLocation has not worked.
So far I am trying to do something like:
SchemaFactory factory = SchemaFactory
.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
XMLCatalogResolver catalogResolver = new XMLCatalogResolver(
new String[]{"/path/to/catalog.xml"});
factory.setResourceResolver(catalogResolver);
Schema schema = factory.newSchema(new StreamSource(ClassLoader
.getSystemResourceAsStream("config.xsd")));
Without much luck.