SchemaLocationResolver fails to download included xsd files
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]
The sensorML xsd locates at:
DBEntityResolver can download it and register it to xml_catalog table.
However, in sensorML.xsd there is a line:
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.
#1 Updated by Jing Tao about 9 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.
#2 Updated by Jing Tao about 9 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.