Opened 13 years ago

Closed 13 years ago

#492 closed defect (fixed)

CSW 2.0.2 ElementName processing broken

Reported by: heikki Owned by: heikki
Priority: minor Milestone: v2.6.4
Component: General Version: v2.6.3
Keywords: csw, getrecords, elementname Cc:

Description

The processing of CSW GetRecords requests containing ElementName parameters seems to be incorrect.

To reproduce:

  • in a new installation of GeoNetwork 2.6.x, login as admin, load all templates, and load the sample metadata;
  • post a GetRecords request containing an XPATH to some random element in ISO19139, and request that for output format too. An example :
<?xml version="1.0" encoding="UTF-8"?>
<csw:GetRecords xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:csw="http://www.opengis.net/cat/csw/2.0.2" xmlns:ogc="http://www.opengis.net/ogc" resultType="results" service="CSW" version="2.0.2" outputSchema="http://www.isotc211.org/2005/gmd">
      <csw:Query typeNames="gmd:MD_Metadata">
              <csw:ElementName>/gmd:MD_Metadata/gmd:contact/gmd:CI_ResponsibleParty/gmd:contactInfo/gmd:CI_Contact/gmd:phone/gmd:CI_Telephone/gmd:voice/gco:CharacterString</csw:ElementName>
      </csw:Query>
</csw:GetRecords>

In the response, some results seem to be correct, like

    <gmd:MD_Metadata xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:srv="http://www.isotc211.org/2005/srv" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:geonet="http://www.fao.org/geonetwork" xsi:schemaLocation="http://www.isotc211.org/2005/gmd http://www.isotc211.org/2005/gmd/gmd.xsd    http://www.opengis.net/gml http://www.opengis.net/gml/gml.xsd">
      <gco:CharacterString>+61 3 8636 2319</gco:CharacterString>
    </gmd:MD_Metadata>

but other results seem blatantly incorrect, e.g. this one containing not the requested element, but other elements not fitting the XPATH in the request:

    <gmd:MD_Metadata xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:gml="http://www.opengis.net/gml" xmlns:gts="http://www.isotc211.org/2005/gts" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:geonet="http://www.fao.org/geonetwork">
      <gmd:CI_ResponsibleParty>
        <gmd:individualName>
          <gco:CharacterString>Marina Zanetti</gco:CharacterString>
        </gmd:individualName>
        <gmd:organisationName>
          <gco:CharacterString>FAO - Land and Water Development Division</gco:CharacterString>
        </gmd:organisationName>
        <gmd:positionName>
          <gco:CharacterString>GIS specialist</gco:CharacterString>
        </gmd:positionName>
        <gmd:role>
          <gmd:CI_RoleCode codeList="./resources/codeList.xml#CI_RoleCode" codeListValue="pointOfContact" />
        </gmd:role>
      </gmd:CI_ResponsibleParty>
    </gmd:MD_Metadata>

or this one that seems to be cut off at some ancestor in the requested XPATH, possible if the document only contained a structure up to there:

    <gmd:MD_Metadata xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:gts="http://www.isotc211.org/2005/gts" xmlns:gsr="http://www.isotc211.org/2005/gsr" xmlns:gss="http://www.isotc211.org/2005/gss" xmlns:gmx="http://www.isotc211.org/2005/gmx" xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:geonet="http://www.fao.org/geonetwork" xsi:schemaLocation="http://www.isotc211.org/2005/gmd http://www.isotc211.org/2005/gmd/gmd.xsd     http://www.opengis.net/gml http://www.opengis.net/gml/gml.xsd     http://www.w3.org/1999/xlink http://www.w3.org/1999/xlink/xlinks.xsd">
      <gmd:contact xlink:href="http://asdd.ga.gov.au/asdd/work/ISOmetadata/GAOpenDaySeries.xml#GADetails" />
    </gmd:MD_Metadata>

A proposed fix for this is to replace the handling of ElementName parameters to no longer use the Jeeves Xpath class, and instead generate an XSLT on the fly that contains

<xsl:copy>
     <xsl:apply-templates select="XPATH-from-ElementName-parameter"/>
     ... etc, for each ElementName parameter ...			
     <xsl:if test="$displayInfo = 'true'">
          <xsl:copy-of select="$info"/>
     </xsl:if>
</xsl:copy>

Change History (2)

comment:1 by heikki, 13 years ago

Status: newassigned

comment:2 by heikki, 13 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.