Xpath Error not detected "slash before predicate"

<oXygen/> general issues.
salhewa
Posts: 1
Joined: Mon Nov 16, 2020 7:14 pm

Xpath Error not detected "slash before predicate"

Post by salhewa » Mon Nov 16, 2020 7:22 pm

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?

Radu
Posts: 7422
Joined: Fri Jul 09, 2004 5:18 pm

Re: Xpath Error not detected "slash before predicate"

Post by Radu » Tue Nov 17, 2020 10:35 am

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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Post Reply