Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Cannot Reproduce
-
XmlSchema 2.0.1
-
None
-
Windows7
Description
I have the following xsd files:
schema1.xsd - contains import to schema2.xsd
schema2.xsd
schema3.xsd - contains import to schema1.xsd
imports are with relative paths (plain file name, all schema files are in the same directory)
Reading of schema1 and schema2 works fine.
Reading of schema3 fails with the following exception and call stack:
Caused by: java.lang.RuntimeException: java.net.MalformedURLException: no protocol: schema1.xsd
at org.apache.ws.commons.schema.resolver.DefaultURIResolver.resolveEntity(DefaultURIResolver.java:72)
at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:684)
at org.apache.ws.commons.schema.SchemaBuilder.handleImport(SchemaBuilder.java:538)
at org.apache.ws.commons.schema.SchemaBuilder.handleSchemaElementChild(SchemaBuilder.java:1513)
at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:659)
at org.apache.ws.commons.schema.SchemaBuilder.build(SchemaBuilder.java:157)
at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:499)
at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:709)
at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:706)
at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:732)
at org.apache.ws.commons.schema.SchemaBuilder.handleImport(SchemaBuilder.java:541)
at org.apache.ws.commons.schema.SchemaBuilder.handleSchemaElementChild(SchemaBuilder.java:1513)
at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:659)
at org.apache.ws.commons.schema.SchemaBuilder.build(SchemaBuilder.java:157)
at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:499)
at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:709)
at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:556)
at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:586)
Debugging shows that:
- when reading schema1.xsd and resolving schema2.xsd (in SchemaBuilder.resolveXmlSchema), the baseUri is file and the operation succeeds
- when reading schema3.xsd and resolving schema1.xsd->schema2.xsd, the baseUri is plain text (schema1.xsd) and not file (file:/c:/schema1.xsd) and the operation fails
Workaround: use full path in the schema location (c:\schema1.xsd instead of schema1.xsd) fixes the problem.
However this workaround is ugly and the recursive import should work without it.
I would be glad to hear your opinions.
Thanks in advance,
Arik Goldstein