Opened 12 years ago

Closed 12 years ago

#1043 closed defect (fixed)

xml resolver should only have oasis catalogs for relevant schema when doing validation

Reported by: simonp Owned by: geonetwork-devel@…
Priority: major Milestone: v2.8.0 RC0
Component: General Version: v2.8.0RC0
Keywords: Cc:

Description

As an example: the codelist schematron uses the xslt document function/capability to retrieve the codelist xml document referred to in each codelist element in the metadata. eg. when processing this element:

<gmd:characterSet>

<gmd:MD_CharacterSetCode codeList="http://asdd.ga.gov.au/asdd/profileinfo/gmxCodelists.xml#MD_CharacterSetCode" codeListValue="utf8" />

</gmd:characterSet>

the codelist schematron will attempt to load the document http://asdd.ga.gov.au/asdd/profileinfo/gmxCodelists.xml to check that the codeListValue attribute is set to something that actually exists. These URLs should be mapped to a local file using an oasis catalog for each schema. If you switch on the debugging output for the xml resolver in GeoNetwork (in WEB-INF/log4j.cfg, log4j.logger.jeeves.xmlresolver = DEBUG) you should see something like the following in your logs showing how these URLs are resolved to local file paths in the codelist validation schematron:

2012-09-12 00:22:11,722 DEBUG [jeeves.xmlresolver] - Trying to resolve http://asdd.ga.gov.au/asdd/profileinfo/GAScopeCodeList.xml:file:/usr/local/jakarta/tomcat-geonetwork/data/config/schema_plugins/iso19139.anzlic/schematron-rules-iso-codeListValidation.xsl 2012-09-12 00:22:11,723 DEBUG [jeeves.xmlresolver] - Resolved as file:/usr/local/jakarta/tomcat-geonetwork/data/config/schema_plugins/iso19139.anzlic/schema/resources/Codelist/GAScopeCodeList.xml

Basically the bug is that only the oasis catalog for the schema against which a record is being validated should be loaded into the resolver when validating - at present *all* oasis catalogs are loaded and that means that the resolver may end up with (in this case for example) resolving to a codelist file that belongs to a different schema and thus the values may not be found. I saw this when looking at this a little earlier for example the log shows a codelist file for the iso19139.mcp-1.4 schema being used in the validation of an iso19139.anzlic record:

2012-09-12 00:22:11,715 DEBUG [jeeves.xmlresolver] - Trying to resolve http://asdd.ga.gov.au/asdd/profileinfo/gmxCodelists.xml:file:/usr/local/jakarta/tomcat-geonetwork/data/config/schema_plugins/iso19139.anzlic/schematron-rules-iso-codeListValidation.xsl 2012-09-12 00:22:11,716 DEBUG [jeeves.xmlresolver] - Resolved as file:/usr/local/jakarta/tomcat-geonetwork/data/config/schema_plugins/iso19139.mcp-1.4/schema/resources/Codelist/gmxCodelists.xml

Change History (2)

comment:1 by simonp, 12 years ago

(XML)Resolver is a singleton that is initialized with the oasis catalogs. It is passed to all the different XML features that can use it (eg. SAXBuilder for parsing XML, Xerces validation stuff for validator and the XSLT transformer (saxon)).

codelist URLs: codelist URLs used in metadata records that belong to a profile should actually point to the codelist that is used for the profile. eg. using http://www.isotc211.org/2005/resources/gmxCodelists.xml (codelists for base iso19115/19139) for the codelist of a profile is incorrect if the profile actually uses a different codelist to that provided by the base standard.

As a result, rather than try to change the code, it seems better to document that:

  • codelist urls should point to the actual codelist being used by the profile
  • oasis catalog entries should exist in one oasis catalog file - duplicates may cause odd behaviour (probably depends on which schema gets loaded first)

So, at this stage, I think the fix for this bug will be:

  • to tidy up the oasis catalogs of all schema plugins (remove duplicates)
  • ensure profiles have URLs etc that point to the actual resources they use (via update-fixed-info.xsl)
  • document what to specify in the oasis catalog of a profile in the GN schema plugin doco

comment:2 by simonp, 12 years ago

Resolution: fixed
Status: newclosed

Fixed in commit 4bd3d985c8d100c1db3318097882a5ce0905e38d

Note: See TracTickets for help on using tickets.