Bug #5300
closedSchemaLocationResolver fails to download included xsd files
0%
Description
I am trying to insert an eml document with embedded sensorML into metacat.
But i get the error:
knb 20110209-11:20:52: [WARN]: DBSaxHandler.warning - schema_reference.4: Failed to read schema document './system.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>. [edu.ucsb.nceas.metacat.DBSAXHandler]
knb 20110209-11:20:52: [ERROR]: DocumentImpl.write - Problem with parsing: schema_reference.4: Failed to read schema document './system.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>. [edu.ucsb.nceas.metacat.DocumentImpl]
java.io.FileNotFoundException: http://chico1.dyndns.org/knb/schema/system.xsd
The sensorML xsd locates at:
http://schemas.opengis.net/sensorML/1.0.1/sensorML.xsd
DBEntityResolver can download it and register it to xml_catalog table.
However, in sensorML.xsd there is a line:
<xs:include schemaLocation="./system.xsd"/>
Our resolver can't download the system.xsd which is part of sensorML schema. Moreover, the system.xsd includes another xsd file,process.xsd, as well. Metacat couldn't download process.xsd either.
Updated by Jing Tao almost 14 years ago
Here is a way probably resolve this issue:
In edu.ucsb.nceas.metacat.service.XMLSchemaService lcass, we will add two new methods:
String[] getIncludeXSDFile(InputStream in); This method will parse the schema file(as an InputStream object) and get the list of include files.
String getBaseURL(String schemaURL); Get the base url of the schema location.
In SchemaLocationReolver.uploadSchemaFromURL call those two methods (maybe recursively?) and will upload all included schema into Metacat.
Any comments?
Updated by Jing Tao almost 14 years ago
Add a new class XMLSchemaPaser which can extract the included schema information.
In XMLSchemaService class, add a new method handleIncludedSchema, it recursively downloads the included schemas. I also wrote a junit test method to test the new change. It works. Close the bug.