#1047: Metadata export generates invalid XML Dublin Core file
--------------------------------------+-------------------------------------
Reporter: klimeto | Owner: geonetwork-devel@…
Type: defect | Status: new
Priority: major | Milestone: v2.9.0
Component: General | Version: v2.8.0RC0
Keywords: XML, Export, Dublin Core |
--------------------------------------+-------------------------------------
XML export of sample Dublin Core metadata is invalid XML file against the
schema assigned within its root: SchemaLocation attribute: Sample metadata
export:
{{{
<?xml version="1.0" encoding="UTF-8"?>
<simpledc xmlns:dc="http://purl.org/dc/elements/1.1/"\[\[BR\]\]
xmlns:dct="http://purl.org/dc/terms/"\[\[BR\]\]
xmlns:geonet="http://www.fao.org/geonetwork"\[\[BR\]\]
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\[\[BR\]\]
xsi:noNamespaceSchemaLocation="http://www.dublincore.org/schemas/xmls/qdc/2008/02/11/simpledc.xsd">\[\[BR\]\]
<dc:title>TESTING MD RECORD</dc:title>
<dc:creator>TOMAS KLIMENT</dc:creator>
<dc:subject>TEST</dc:subject>
<dc:subject>JRC</dc:subject>
<dc:description>DESCRIPTION</dc:description>
<dc:publisher>KLIMENT</dc:publisher>
<dc:type>testing resource</dc:type>
<dc:format>text/plain</dc:format>
<dc:language>eng</dc:language>
<dc:relation>http://…</dc:relation>
<dc:coverage>North 90, South -90, East 180, West -180.
Global</dc:coverage>
<dc:rights>Fre for testing</dc:rights>
<dct:created>now</dct:created>
<dct:dateSubmitted>tomorrow</dct:dateSubmitted>
<dct:modified>2012-09-13T11:39:44</dct:modified>
<dc:identifier>8352f5b4-8be4-4f69-820c-
da810f24b988</dc:identifier>
</simpledc>
}}}
However it assigns to a schemaLocation attribute simpledc schema, which
does not allow elements from dct namespace (dct:created, dct:dateSubmitted
etc) thus it causes validation errors:
{{{
Element <dct:created> is not allowed under element <simpledc>.
Reason: The following elements are expected at this location (see
below)
<relation>
<creator>
<title>
<format>
<rights>
<identifier>
<subject>
<type>
<source>
<publisher>
<contributor>
<language>
<coverage>
<description>
<date>
Annotations of type 'dc:elementContainer' (see below)
This complexType is included as a convenience for schema
authors who need to define a root
or container element for all of the DC elements.
Error location: simpledc / dct:created
Details
cvc-model-group: Element <dct:created> unexpected by type
'dc:elementContainer' of element <simpledc>.
cvc-elt.5.2.1: The element <simpledc> is not valid with
respect to the actual type definition 'dc:elementContainer'.
}}}
One solution how to resolve this would be to change the schemaLocation and
root as follows:
{{{
<?xml version="1.0" encoding="UTF-8"?>
<qualifieddc xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:dct="http://purl.org/dc/terms/"
xmlns:geonet="http://www.fao.org/geonetwork"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://dublincore.org/schemas/xmls/qdc/2008/02/11/qualifieddc.xsd"
>
<dc:title>TESTING MD RECORD</dc:title>
<dc:creator>TOMAS KLIMENT</dc:creator>
<dc:subject>TEST</dc:subject>
<dc:subject>JRC</dc:subject>
<dc:description>DESCRIPTION</dc:description>
<dc:publisher>KLIMENT</dc:publisher>
<dc:type>testing resource</dc:type>
<dc:format>text/plain</dc:format>
<dc:language>eng</dc:language>
<dc:relation>http://…</dc:relation>
<dc:coverage>North 90, South -90, East 180, West -180.
Global</dc:coverage>
<dc:rights>Fre for testing</dc:rights>
<dct:created>now</dct:created>
<dct:dateSubmitted>tomorrow</dct:dateSubmitted>
<dct:modified>2012-09-13T11:39:44</dct:modified>
<dc:identifier>8352f5b4-8be4-4f69-820c-
da810f24b988</dc:identifier>
</qualifieddc>
}}}
And this is valid XML file.
--
Ticket URL: <http://trac.osgeo.org/geonetwork/ticket/1047>
GeoNetwork opensource Developer website <http://sourceforge.net/projects/geonetwork/>
GeoNetwork opensource is a standards based, Free and Open Source catalog application to manage spatially referenced resources through the web. It provides powerful metadata editing and search functions as well as an embedded interactive web map viewer. This website contains information related to the development of the software.