Opened 12 years ago
Closed 12 years ago
#1047 closed defect (fixed)
Metadata export generates invalid XML Dublin Core file
Reported by: | klimeto | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | v2.10.0 RC0 |
Component: | General | Version: | v2.8.0RC0 |
Keywords: | XML, Export, Dublin Core | Cc: | jesse.eichar@…, klimeto |
Description
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.
Change History (2)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
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.