geonetwork / core-geonetwork

GeoNetwork is a catalog application to manage spatially referenced resources. It provides powerful metadata editing and search functions as well as an interactive web map viewer. It is currently used in numerous Spatial Data Infrastructure initiatives across the world.
http://geonetwork-opensource.org/
GNU General Public License v2.0
429 stars 489 forks source link

Issues with namespaces in snippets when editing metadata #1503

Closed josegar74 closed 7 months ago

josegar74 commented 8 years ago

Adding elements defined as snippets in the metadata editor (for example in the INSPIRE view), the elements get some extra namespaces that are not used in the element. For example:

 <gmd:hierarchyLevel 
                 xmlns:gmx="http://www.isotc211.org/2005/gmx"
                 xmlns:srv="http://www.isotc211.org/2005/srv"    
                 xmlns:gn="http://www.fao.org/geonetwork">
      <gmd:MD_ScopeCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/codelist/ML_gmxCodelists.xml#MD_ScopeCode"
                        codeListValue="dataset"/>
   </gmd:hierarchyLevel>

gmxand srvcan be avoided if the template would contain them in the header. But not really sure why are added, should be better not to add them at all as not really used inside the metadata (at least for the default dataset template)

gn is a bit more tricky as it's a defined as xmlns:gn="http://www.fao.org/geonetwork', but that url is used in other places for geonet namespace. I guess at least that should be unified.

I suspect the issue is related to the namespaces defined in https://github.com/geonetwork/core-geonetwork/blob/develop/web/src/main/webapp/xslt/ui-metadata/edit/edit.xsl#L25-L33, but I would expect that exclude-result-prefixes="#all" would manage this nicely.

Another issue related to geonet namespace is that when saving the metadata the xml header gets the definition of this "internal" namespace, what is not good.

josegar74 commented 8 years ago

The problem seem when serializing the snippet to send in https://github.com/geonetwork/core-geonetwork/blob/develop/web/src/main/webapp/xslt/ui-metadata/form-builder.xsl#L599-L600, it gets added the extra namespaces.