geonetwork / core-geonetwork

GeoNetwork is a catalog application to manage spatially referenced resources. It provides powerful metadata editing and search functions as well as an interactive web map viewer. It is currently used in numerous Spatial Data Infrastructure initiatives across the world.
http://geonetwork-opensource.org/
GNU General Public License v2.0
412 stars 487 forks source link

Valid ISO 19115-3 record in geonetwork is not valid if testing using the schemaLocation url #5737

Open ZhuoyueZhou-USDA opened 3 years ago

ZhuoyueZhou-USDA commented 3 years ago

Describe the bug I have imported several records (iso 19115-3.2018) into geonetwork, they are all showing valid after I have validated them. I disable the inspire validation. image

However, after I have exported them, and try to validate in Oxygen using 'Apply default validation', I got several errors. In the records, the xsi:schemaLocation was defined as 'xsi:schemaLocation="http://standards.iso.org/iso/19115/-3/mds/2.0 http://standards.iso.org/iso/19115/-3/mds/2.0/mds.xsd" ' image

I also tried to update the schemaLocation to 'http://standards.iso.org/iso/19115/-3/mdb/2.0 https://schemas.isotc211.org/19115/-3/mdb/2.0/mdb.xsd' based on this commit: https://github.com/geonetwork/core-geonetwork/commit/e0c08312505c0d5d85ec67cfe055c9af7f9c3433 image

To Reproduce Steps to reproduce the behavior:

  1. Import a valid record into GeoNetwork, and validate it.
  2. Export the record and open using Oxygen or other validation apps
  3. Try to validate the record using the default validation. (schemaLocation)
  4. See if the record is valid or not

Expected behavior The validation results in GeoNetwork should be the same as validate against the official schema.

Screenshots If applicable, add screenshots to help explain your problem.

Log file If applicable, add the server log file to help trace your problem.

Desktop (please complete the following information):

fxprunayre commented 3 years ago

GeoNetwork use https://github.com/geonetwork/core-geonetwork/blob/main/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/schema.xsd when there is no schemaLocation defined in the XML document to validate. If it is defined, then it use it.

For me using schemaLocation="http://standards.iso.org/iso/19115/-3/mdb/2.0 https://schemas.isotc211.org/19115/-3/mdb/2.0/mdb.xsd" seems consistent with the internal validation.

In your screenshot, errors sound more related to the GML namespace so the XSD validation in itself works ok - maybe you can check that the correct of GML version is used ? Should be GML3.2 https://github.com/geonetwork/core-geonetwork/blob/main/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/schema.xsd#L45. Can be an error with the map widget adding polygons ?

ZhuoyueZhou-USDA commented 3 years ago

@fxprunayre Thank you for your reply. In the namespace declaration, it is using gml 3.2. image

sample.zip

I have attached a sample metadata record. Here is what I have done.

  1. If I import this record into geonetwork, and did the validation, here is what I get: I wonder if it's because I use geonetwork 3.10.6. image

  2. If I change the xsi:schemaLocation to be xsi:schemaLocation="http://standards.iso.org/iso/19115/-3/mds/2.0 http://standards.iso.org/iso/19115/-3/mds/2.0/mds.xsd" Here is what I get in geonetwork after I click the validate button. image

  3. If I remove the xsi:schemaLocation in line 31, and validate again in GeoNetwork. I get a valid response.

  4. If I validate this record against the schema.xsd (in geonetwork schema plugin folder) using Oxygen, I get 'Validation successful' response.

  5. If I validate this record in Oxygen, using 'Apply default validation' option, which means validate against the schema defined in xsi:schemaLocation. Here is the validation error I received: image