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

track down xpath issue in resource.keywords.controlled #443

Open
jeanetteclark opened this issue Jan 19, 2024 · 4 comments
Open

track down xpath issue in resource.keywords.controlled #443

jeanetteclark opened this issue Jan 19, 2024 · 4 comments

Comments

@jeanetteclark
Copy link
Contributor

jeanetteclark commented Jan 19, 2024

Description

This check returns this error: 20240119-13:01:47: [ERROR]: Selector 'thesaurusPresent' could not select single value with given Xpath: A location step was expected following the '/' or '//' token. [edu.ucsb.nceas.mdqengine.processor.XMLDialect] silently (the check appears to fail without error). Still working on figuring out the cause. The selector is:

<selector>
    <name>keywordGroups</name>
    <xpath>
           /resource/subjects |
           /*/identificationInfo/*/descriptiveKeywords |
           /eml/dataset/keywordSet
      </xpath>
    <subSelector>
      <name>thesaurusPresent</name>
      <xpath>(
        ./subject[subjectScheme/text()[normalize-space()]] or
        ./MD_Keywords/thesaurusName[not(@nilReason="unknown")] or
        ./keywordThesaurus
        )
      </xpath>
    </subSelector>
  </selector>

working theory is this line in metadig-engine, XMLDialect:348 NodeList nodes = (NodeList)xpath.evaluate(selectorPath, contextNode, XPathConstants.NODESET); is expecting a node set but the selector is returning a boolean. Remains to be seen why other checks where boolean is returned (seem? need to check) to work fine.

Running line by line in the debugger, I can get that line of code to work fine in the debugger console without the XPathConstants.NODESET param. The debug console doesn't like it when I run with the parameter (XPathConstants cannot be resolved to a variable.) even though the correct import statement exists

@mbjones
Copy link
Member

mbjones commented Jan 20, 2024

@jeanetteclark Is the trailing parenthesis in the selector block unmatched? Maybe this is just a syntax issue?

@jeanetteclark
Copy link
Contributor Author

I don't think so, I have looked at those parentheses making sure there aren't syntax errors for a long time. You can see the opening parentheses on the first line after the opening <xpath> tag. let me know if you see different though I would be happy at this point to find out its a simple syntax things

@mbjones
Copy link
Member

mbjones commented Jan 23, 2024

Ah yes, I see it now. Sorry for the red herring.

@jeanetteclark
Copy link
Contributor Author

no worries - based on the error it does seem like a syntax issue but after much time in the debugger I think I have ruled that out

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

2 participants