I'm trying to use org.eclipse.xsd 2.8.0 (in Eclipse Juno) to parse XBRL taxonomy schemas.
To quote the official description of the XBRL Global Ledger Framework; "The structure of the taxonomies is such that a complete taxonomy is "compiled" by assembling a set of schemas via a "palette" schema".
Basically, this means that there's a set of .xsd files glued together with import's.
Unfortunately I'm stuck at the fundamental task of getting XSD to automatically resolve the imports at load time, using boilerplate example code. XSD only loads the top-level schema document and the diagnostics for that XSDSchema reveals that the imported schemas doesn't get resolved because the imports are not used:
Line 4 Column 4: warning: XSD: The location 'gl-cor-content-2006-10-25.xsd' has not been resolved because the import is unused
Line 4 Column 4: warning: XSD: There is no xmlns declaration for namespace '[Redacted because this stupid forum thinks I'm trying to spam the forum with an off site link]'
How can I force XSD to resolve the imports?
The code I'm using:
ResourceSet tResourceSet = XSDSchemaImpl.createResourceSet();
Registry tRegistry = tResourceSet.getResourceFactoryRegistry();
Map<String, Object> tFactoryMap = tRegistry.getExtensionToFactoryMap();
tFactoryMap.put("xsd", new XSDResourceFactoryImpl());
Map<Object, Object> tLoadOptions = tResourceSet.getLoadOptions();
String tFile = "/tmp/gl/2006-10-25/plt/case-c/gl-plt-2006-10-25.xsd";
URI tUri = URI.createFileURI(tFile);
Resource tResource = tResourceSet.getResource(tUri, true);
System.out.println("Resources loaded in set: " + tResourceSet.getResources().size());
The XBRL GL schemas are available here:
h t t p : / / www.xbrl.org/int/gl/2007-04-17/GLFramework-REC-2007-04-17.zip