Uploaded image for project: 'Configuration Persistence Service'
  1. Configuration Persistence Service
  2. CPS-336

Ends-with functionality in cpsPath does not conform with standard xPath behavior

XMLWordPrintable

      Given a model containing data like below

      1. /bookstore/category
      2. /bookstore/category/subcategory

      Actual Behavior
      ==========

      currently cpsPath can be used to execute a query with a cpsPath of '//category' which is interpreted as xPath "ends-with the string 'category'"

      and it will return both above data elements as the both end in 'category'. Also '//ry' would return the same result

      to prevent ambiguity we recommended and have written test with '///category' looking for xPaths that end in '/category' and do NOT match '/subcategory'

       

      Expected Behavior
      ============

      However in XPath preceding '/' is implied and '//category' should only match the whole node identifier. So '//category' will only match  '/bookstore/category' and NOT '/bookstore/category/subcategory'. ''//ry' wil match nothing!

      using three slashes ('///category') is invalid syntax in xPath

      Proposed changes

      1.  When creating the target-string used by ends-with expression in the DB query, prefix it with a singel '/' to get the required results
      2. (optional) Before creating the target -string check if it starts with a '/' and if so throw an exception that the cpsPath expression is invalid

            ToineSiebelink Toine Siebelink
            ToineSiebelink Toine Siebelink
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: