[GeoNetwork-devel] [GeoNetwork opensource Developer website] #1047: Metadata export generates invalid XML Dublin Core file

#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/&quot;\[\[BR\]\]
xmlns:dct="http://purl.org/dc/terms/&quot;\[\[BR\]\]
  xmlns:geonet="http://www.fao.org/geonetwork&quot;\[\[BR\]\]
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;\[\[BR\]\]
xsi:noNamespaceSchemaLocation="http://www.dublincore.org/schemas/xmls/qdc/2008/02/11/simpledc.xsd&quot;&gt;\[\[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/&quot;
xmlns:dct="http://purl.org/dc/terms/&quot;
xmlns:geonet="http://www.fao.org/geonetwork&quot;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
xsi:noNamespaceSchemaLocation="http://dublincore.org/schemas/xmls/qdc/2008/02/11/qualifieddc.xsd&quot;
>
         <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&gt;
GeoNetwork opensource Developer website <http://sourceforge.net/projects/geonetwork/&gt;
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.

#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 |
--------------------------------------+-------------------------------------

Comment(by simonp):

Try it out again now following the commits to 2.8.x and trunk. The schema
location hint now points to the schema.xsd file used by GeoNetwork - this
schema file includes a declaration of simpledc and imports the dct
namespace. Hopefully we'll be able to keep our current simpledc approach
in place.

--
Ticket URL: <http://trac.osgeo.org/geonetwork/ticket/1047#comment:1&gt;
GeoNetwork opensource Developer website <http://sourceforge.net/projects/geonetwork/&gt;
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.

#1047: Metadata export generates invalid XML Dublin Core file
----------------------+-----------------------------------------------------
  Reporter: klimeto | Owner: geonetwork-devel@…
      Type: defect | Status: closed
  Priority: major | Milestone: v2.9.0
Component: General | Version: v2.8.0RC0
Resolution: fixed | Keywords: XML, Export, Dublin Core
----------------------+-----------------------------------------------------
Changes (by simonp):

  * status: new => closed
  * resolution: => fixed

--
Ticket URL: <http://trac.osgeo.org/geonetwork/ticket/1047#comment:2&gt;
GeoNetwork opensource Developer website <http://sourceforge.net/projects/geonetwork/&gt;
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.