Validate Metadata (Conversion)
Summary
Exports metadata to a standard metadata format then validates the exported file.
ArcGIS metadata can't be directly validated against a metadata standard's XML schema. This tool validates ArcGIS metadata by first exporting it to an XML file that is formatted to follow a metadata standard's XML schema using Export Metadata, then validating the exported file using XML Schema Validation. Only use this tool to validate ArcGIS metadata, not a stand-alone XML file that is already formatted correctly for a metadata standard's XML format.
Any validation errors and warnings will be reported in the tool's messages.
Usage
Some XML Schemas require you to specify the XML namespace you want to validate, while others do not. If a value is provided in the Namespace URI parameter when none is required, any warnings or errors reported will be related to not finding the correct information in the XML Schema and won't identify whether the XML document is valid.
For example, if you try to validate an XML document that follows the Federal Geographic Data Committee (FGDC) Content Standard for Digital Geospatial Metadata (CSDGM) using the XML Schema http://www.fgdc.gov/schemas/metadata/fgdc-std-001-1998.xsd, you should not provide a value in the Namespace URI parameter.
When validating an XML document using a DTD, the name of the element that will be validated must be provided in the Namespace URI parameter. For example, if a DOCTYPE declaration were added to an XML document referencing an external DTD, that syntax might look like this: <!DOCTYPE metadata SYSTEM "http://www.fgdc.gov/schemas/metadata/fgdc-std-001-1998.dtd">. To validate an XML document using this same external DTD with this tool, you would provide the value http://www.fgdc.gov/schemas/metadata/fgdc-std-001-1998.dtd in the Schema URL parameter. Provide the name of the root element in the XML document in the Namespace URI parameter: metadata. The root element's content is validated.
If the XML document being validated contains an embedded reference to an external XML Schema or XML DTD, that schema will not be used for validation. The schema to use for validation and the namespace or root element to validate must be explicitly specified in this tool's Schema URL and Namespace URI parameters.
-
Specify an output file if you want to keep the exported metadata file. For example, after checking that the exported file validated successfully you might publish it to a metadata catalog.
-
The output files produced by this tool can't be stored in a geodatabase. If the Current_workspace environment is set to a geodatabase, the output files will be stored in a different location, as described below.
- If Current_workspace is set to a file or personal geodatabase, the output files will be stored in the folder in which the geodatabase is stored.
- If Current_workspace is set to an enterprise or workgroup geodatabase, the output files will be stored in the location defined by the system TEMP environment variable.
Syntax
Parameter | Explanation | Data Type |
Source_Metadata |
The item whose metadata will be validated or a stand-alone XML file that will be validated. | Data Element; Layer |
Translator |
An XML file that defines the conversion that will be performed. The translator files provided with ArcGIS for Desktop can be found in the <ArcGIS Installation Location>\Metadata\Translator folder. The following translators are provided:
| File |
Schema_URL |
The XML Schema or XML DTD that describes the structure and content of a valid XML document. | String |
Namespace_URI (Optional) |
The XML namespace that will be validated for an XML Schema, if appropriate, or the root element of the document for an XML DTD. If this value is inappropriate for the XML Schema being used, provide the pound sign (#) instead of a namespace URI. | String |
Output_File |
A stand-alone XML file that will be created containing the converted metadata. | File |
Code Sample
Exports ArcGIS metadata to an XML file and validates the exported file using an XML Schema.
import arcpy
from arcpy import env
env.workspace = "C:/data"
#set local variables
dir = arcpy.GetInstallInfo("desktop")["InstallDir"]
translator = dir + "Metadata/Translator/ESRI_ISO2ISO19139.xml"
schema = "http://www.isotc211.org/schemas/2005/gmd/metadataEntity.xsd"
namespace = "http://www.isotc211.org/2005/gmd"
arcpy.ValidateMetadata_conversion ("vegtype.dbf", translator, schema,
namespace, "vegtype_19139.xml")