Page 1 of 1

Xpath Error not detected "slash before predicate"

Posted: Mon Nov 16, 2020 7:22 pm
by salhewa
I'm currently running Oxygen editor 22.1 and an Xpath error that should have been reported as an error is not showing up. Perhaps I'm missing something. Here's some sample xml and xpath that I'm running.

Code: Select all

<document>
  <names>
      <name>
        <surname>testOne</surname>
      </name>
    <name>
      <surname>testTwo</surname>
    </name>
    <name>
      <surname>testThree</surname>
    </name>
  </names>
</document>
If I run the xpath //name/[surname eq 'invalid'] in xpath evaluator I get a query returned no results. Shouldn't it actually catch that there is a '/' before the start of the predicate and report that as an invalid xpath?

Re: Xpath Error not detected "slash before predicate"

Posted: Tue Nov 17, 2020 10:35 am
by Radu
Hi,

I asked on the XML.com Slack channel and it seems your XPath is valid because there is an array constructor in the XPath specs: https://www.w3.org/TR/xpath-31/#id-array-constructors

Regards,
Radu