Uploaded image for project: 'Daffodil'
  1. Daffodil
  2. DAFFODIL-1279

Need DPath warnings when paths are not encapsulated with fn:exists(....)

    XMLWordPrintableJSON

Details

    Description

      Expressions like

      { ../foo/bar eq 3 }
      

      are very error prone. If node ../foo/bar doesn't exist you get a runtime Schema Definition Error, which is fatal, not backtrackable.

      Really what is needed is:

      { if fn:exists(../foo/bar) then ../foo/bar eq 3 else daf:error("....") }
      

      The DPath compiler should warn when a path is being used which may not exist, but is not wrapped in fn:exists(....) and if-then-else.

      But that may really not be the right warning. Probably such expressions really should be moved to a location in the schema where the elements they are referring to simply must exist. E.g., if the expression was on element bar, or a sub-component within the schema of element bar, then the existence of element bar (and its parent foo) is implied and the expression can't get a runtime SDE.

      See also related Bug DFDL-1278.

      Attachments

        Activity

          People

            Unassigned Unassigned
            mbeckerle Mike Beckerle
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: