Uploaded image for project: 'Daffodil'
  1. Daffodil
  2. DFDL-886

Issue when occursIndex() used on sequence to determine separator

XMLWordPrintableJSON

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 1.1.0
    • None
    • None
    • None

      I've been trying to put together a schema/test that parses 3 different characters, and then has three sequences (all part of a top-level sequence with '|' as the separator). The first sequence will have the first character as a separator, the second sequence will use the second character, and so on. So this is my input:

      .|-|#|1.2.3|1-2-3|3#9#1

      debug output:

      ..... 
      (debug) 
      separator [1]: xs:string: -
        infoset:
          <ex:e2 xmlns:ex="http://example.com">
            <ex:a1>.</ex:a1>
            <ex:a1>-</ex:a1>
            <ex:a1>#</ex:a1>
            <ex:a2>
              <ex:num>1</ex:num>
            </ex:a2>
          </ex:e2>
        data:
                 │ (7 to 7)
          .|-|#|1.2.3|1-2-3|3#9#1
        failure:
          Parse Error: Sep('CompiledExpression({ fn:trace(xs:string(/ex:e2/ex:a1[dfdl:occursIndex()]), 'separator') })') - sequence: Delimiter not found!
          Schema context: sequence Location line 32 column 116 in file:/tmp/daffodil_tmp_7144462590172026171.dfdl.xsd
          Data location was preceding byte 7
          UTF-8 text starting at byte 0 is: (.|-|#|1.2.3|1-2-3|3#9#1)
          Data (hex) starting at byte 0 is: (0x2E7C2D7C237C312E322E337C312D322D337C3323392331)
       
       
      The output from sbt is similar:
      separator [1]: xs:string: .
      separator [1]: xs:string: -
      [error] Test edu.illinois.ncsa.daffodil.section16.array_optional_elem.TestArrayOptionalElem.test_arrayExpressions02 failed: edu.illinois.ncsa.daffodil.processors.ParseError: Parse Error: Sep('CompiledExpression({ fn:trace(xs:string(/ex:e2/ex:a1[dfdl:occursIndex()]), 'separator') })') - sequence: Delimiter not found!

      It seems to correctly find the separator in order to fill in the num element, but still fails.

      I created a few more tests to try and narrow down the issue:
      arrayExpressions02b - demonstrates that you can use an expression referencing a previous element to set the separator
      arrayExpressions02c - similar to arrayExpressions02, except the expression with occursCount is used for the terminator property of the innermost element.
      arrayExpressions02d - similar to arrayExpressions02, except the expression with occursCount is used for the initiator of the top-level element instead of the sequence separator.

      It seems that this is only a problem when used in a property of the sequence.

      see test arrayExpressions02 in the following files:
      daffodil-test/src/test/scala-debug/edu/illinois/ncsa/daffodil/section16/array_optional_elem/TestArrayOptionalElemDebug.scala
      daffodil-test/src/test/scala/edu/illinois/ncsa/daffodil/section16/array_optional_elem/TestArrayOptionalElem.scala
      daffodil-test/src/test/resources/edu/illinois/ncsa/daffodil/section16/array_optional_elem/ArrayOptionalElem.tdml

              jchab Jessie Chab
              jchab Jessie Chab
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - Not Specified
                  Not Specified
                  Logged:
                  Time Spent - 1 hour, 56 minutes
                  1h 56m