Customize Metadata Validation
When a metadata documented is evaluated by the Geoportal Server during the publication process, the geoportal can use validation rules from a variety of sources to determine whether the document is of the necessaray quality or not. The validation mechanisms are defined in the corresponding metadata profile’s definition.xml file (suggested reading: Add a Custom Profile). These validation mechanisms are:
- Validation rules set within the definition.xml file itself. If the definition.xml file contains <parameter> elements, there is a child element called ‘validation’. If the validation element’s ‘required’ attribute is set to “true”, then the metadata element defined by that <parameter> will need to be present for the metadata document to be published to the geoportal. Note, if you publish metadata by harvesting a THREDDS server, you may need to make the validation rules in the iso-19115-2-definition.xml file less stringent using this method.
- Validation rules defined in an xsd. The definition.xml file can reference an xsd for validation. To reference an xsd, first make sure the xsd is available at a location accessible to your geoportal (e.g., a local directory or location on the web). Then add a new attribute to the <schema> element in the definition.xml file called xsdLocation. Set the xsdLocation attribute equal to the location of the xsd, as shown in the iso-19115-definition.xml file below where the xsd location is provided by default:
<schema key="iso-19115" templateFile="gpt/metadata/iso/iso-19115-template.xml" cswOutputSchema="http://www.isotc211.org/2005/gmd" cswBriefXslt="gpt/metadata/iso/apiso-brief.xslt" cswSummaryXslt="gpt/metadata/iso/apiso-summary.xslt" xsdLocation="http://www.isotc211.org/2005/gmd/metadataEntity.xsd">
- Validation rules defined by Schematron. The definition.xml file can reference a Schematron file for validation. To reference a Schematron document, first make sure the Schematron is available at a location accessible to your geoportal (e.g., a local directory or location on the web). Then add a new attribute to the <schema> element in the definition.xml file called schematronXslt. Set the schematronXslt attribute equal to the location of the Schematron, as shown in the gemini-iso-19115-definition.xml file below where the Schematron location is provided by default:
<schema key="gemini-iso-19115" cswOutputSchema="http://www.isotc211.org/2005/gmd" cswBriefXslt="gpt/metadata/iso/apiso-brief.xslt" cswSummaryXslt="gpt/metadata/iso/apiso-summary.xslt" schematronXslt="gpt/metadata/iso/gemini/gemini-schematron.xslt" detailsXslt="gpt/metadata/iso/iso-details.xslt">
The Geoportal Server will use one validation mechanism at a time to validate a record. If you have enabled all three of these validation mechanisms, it will validate records in the following order:
- Validate based on the validation rules in the definition.xml <parameter> elements, displaying any errors found.
- If you fix those problem elements and attempt to publish again, it would pass validation on the <parameter> elements, but would then show any errors that result from the xsd validation.
- If you fix the problem elements and attempt to publish again, it would pass the first two mechanisms of validation and finally apply the Schematron validation, displaying errors associated with that.
Alternatively, you can turn off validation by setting the <parameter> validation=”false” for elements, and not including a reference to an xsd or a Schematron.
After making any changes to the definition.xml file, you will need to save the file and restart your geoportal web application for changes to take affect.
IMPORTANT: Changing validation rules only affects documents published to the geoportal from that point on. It does not test documents already published successfully to the geoportal, unless they are on a regular harvest schedule or they are opened in the metadata editor form for editing.
Back to Customizations