Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSW GetRecords with elementSetName=full returns "Invalid XPath expression" #8020

Open
streino opened this issue May 7, 2024 · 0 comments
Open

Comments

@streino
Copy link

streino commented May 7, 2024

Describe the bug

On some catalogs, the following request :

geonetwork/srv/fre/csw-test?service=CSW&version=2.0.2&namespace=xmlns:csw=http://www.opengis.net/cat/csw&outputFormat=application/xml&outputSchema=http://www.isotc211.org/2005/gmd&request=GetRecords&typeNames=csw:Record&resultType=results&elementSetName=full

returns no results, with error in comments :

<csw:GetRecordsResponse xmlns:csw="http://www.opengis.net/cat/csw/2.0.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/cat/csw/2.0.2 http://schemas.opengis.net/csw/2.0.2/CSW-discovery.xsd">
  <csw:SearchStatus timestamp="2024-05-07T16:02:24" />
  <csw:SearchResults numberOfRecordsMatched="41" numberOfRecordsReturned="10" elementSet="full" nextRecord="11">
    <!-- Invalid XPath expression: "/csw:Record//": Expected one of '.', '..', '@', '*', <QName> -->
    <!-- Invalid XPath expression: "/csw:Record//": Expected one of '.', '..', '@', '*', <QName> -->
    ...
  </csw:SearchResults>
</csw:GetRecordsResponse>

To Reproduce

I was able to reproduce with the following steps:

  1. Go to 'Geonetwork admin > Settings > CSW > Customize element set'
  2. Click 'Add'
  3. Enter a single space character in the XPath definition and save
  4. Run a GetRecords request on the CSW endpoint with elementsetName=full => error
  5. Remove the invalid xpath from step 3 and save
  6. Re-run the request from step 4 => ok

Expected behavior

The GetRecords request returns results.

Log file

log.txt

Additional context

Encountered issue on GN 3.10.4 and 4.4.1.

The following changes in the problematic request will return results as expected:

  • Set elementsetName to brief or summary insteand of full.
  • Replace elementsetName=full with ElementName=//*.

I traced the issue to the following: Invalid xpath can be added to elemNames, then processed.

Possibly related issues :

@streino streino changed the title CSW GetRecords request with elementSetName=full returns "Invalid XPath expression" CSW GetRecords with elementSetName=full returns "Invalid XPath expression" May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant