.. _metadata_xml_validation:
Metadata Validation services
============================
These services are for validating metadata against the XML schema documents (XSDs) and schematrons specified as part of a GeoNetwork Metadata Schema. See :ref:`schemaPlugins` for more details.
.. index:: xml.metadata.validation
Validate a metadata record (xml.metadata.validation)
----------------------------------------------------
This service can be used to validate a metadata record supplied as an XML parameter. The metadata record is first passed through the GeoNetwork schema detection rules (see :ref:`schemaPlugins`). After successful schema detection the metadata record is validated against the XML schema documents and schematrons (if any) specified in that schema.
Authentication required: No
Request
```````
Parameters:
- **data**: Metadata record.
Example with an ISO19115/19139 metadata record::
Url:
http://localhost:8080/geonetwork/srv/eng/xml.metadata.validation
Mime-type:
application/xml
Post request:
.....
Response
````````
If the validation is successful an HTTP 200 response code is returned along with
an XML document giving details of the GeoNetwork metadata schema that the record
matched and was successfully validated against.
Example::
yiso19139
If the validation was not successful then an HTTP 500 error response code is returned along with an XML document describing the validation problems. An example is::
XSD Validation error(s):
.....
.....
engxml.metadata.validation
.. note:: XML parseable description of the validation problems is in the object container.
Validation may also fail when schematrons are applied to the metadata record. An HTTP error response code is returned along with an XML document describing the validation problems. An example is::
^M
Schematron errors detected
.....
.....
.. note:: XML parseable description of the schematron validation problems is in the object container. You should be looking for elements such as svrl:failed-assert.
See :ref:`exception_handling` for more details.
Errors
``````
- **bad-parameter XXXX**, when a
mandatory parameter is empty. Returns 500 HTTP code
- **XSD Validation Error (error id:
xsd-validation-error)**, when validation against XSDs fails.
Returns 500 HTTP code
- **Schematron Validation Error (error id:
schematron-validation-error)**, when validation against schematrons fails.
Returns 500 HTTP code
- **No Schema Matches (error id:
no-schema-matches)**, when a matching GeoNetwork metadata schema cannot be
found for the supplied metadata record.
Returns 500 HTTP code