Opened 12 years ago

Last modified 12 years ago

#971 new defect

Cannot add subsequent keywords

Reported by: geomsp Owned by: geonetwork-devel@…
Priority: major Milestone: v2.8.0
Component: General Version:
Keywords: Cc:

Description

We just installed the 2.8 version, and realized a problem whikle addind a new keyword from the metadata form.

In 2.7, we could simply click the "+" button to add a keyword field. In 2.8, the field is still generated, but when we try to save the metadata, the content of the added fields are deleted. Only the first one seems to stay.

The validation tool gives this: error Element 'gmd:keyword' cannot have character [children], because the type's content type is element-only. (Element: gmd:keyword with parent element: gmd:MD_Keywords)

The bug seems to affect only the "handmade" keywords (those added using a Thesaurus are ok).

Any idea about how to correct this minor, but very troubling problem?

Change History (3)

comment:1 by simonp, 12 years ago

Version: v2.6.4

In 2.8: gmd:keyword can have either a gco:CharacterString or gmx:Anchor child.

When the gmd:descriptiveKeywords/gmd:MD_Keywords element is added, gmd:keyword is a mandatory child and so it gets added but gmd:keyword can't be added because the user has to choose whether it has a gco:CharacterString or gmx:Anchor child first - so what is actually added is a gmd:keyword without a child hence the removal of any text content that you add to it and validation error.

This looks to be a bug in EditLib/fillElement

comment:2 by simonp, 12 years ago

Simple workaround for 2.8 would be to remove the suggestions for gmd:keyword - this would return the behaviour to 2.7 and earlier versions. However the problem will reoccur when someone adds a suggestion to a mandatory element especially now that gmx:Anchor support is present.

comment:3 by fxp, 12 years ago

It also happens with gmd:RS_Identifier/gmd:code with the suggestion

	<field name="gmd:code">
		<suggest name="gco:CharacterString"/>
		<suggest name="gmx:FileName"/>
		<suggest name="gmx:Anchor"/>
	</field>

only

<gmd:identifier>
  <gmd:RS_Identifier>
	<gmd:code/>
  </gmd:RS_Identifier>
</gmd:identifier>

is created.

Due to the cardinality 1..1 one gmd:code is created but no child. There is no workaround like keyword where you can still create new element, choose a type and create the element.

The metadocument does not list the suggestion.

<gmd:RS_Identifier>
  <gmd:code>
    <geonet:element ref="76" parent="75" uuid="gmd:code_d9bcaa17-edbd-4006-853d-fc617c49ddb0" min="1" max="1"/>
     <geonet:attribute name="gco:nilReason" add="true">
     <geonet:text value="inapplicable"/>
     <geonet:text value="missing"/>
     <geonet:text value="template"/>
     <geonet:text value="unknown"/>
     <geonet:text value="withheld"/>
    </geonet:attribute>
  </gmd:code>

We should get a geonet:choose element here ?

Note: See TracTickets for help on using tickets.