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

Need dfdl:valueLength support during parse

XMLWordPrintableJSON

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Blocking Blocking
    • 2.0.0
    • None
    • None
    • None

      The PNG file format has something like this:

      Field1: NUL-terminated ASCII
      Field2: Int8
      Field3: Int8
      Field4: NUL-terminated ASCII
      Field5: NUL-terminated UTF-8
      Field6: UTF-8

      The combined lengths (in bytes) of all fields is known. In order to determine the length of Field6 we need to take the combined length of all fields and subtract the length of Fields 1 through 5 and the NUL terminating bytes. So Field6 has something like:

      dfdl:length="{ ../PayloadLength - (fn:string-length(../Field1) + fn:string-length(../Field4) + .fn:string-length(../Field5) + 5)

      The issue here is the Field5 is UTF-8, which is variable length, so fn:string-length is not necessarily the same as the number of bytes. We need some way to determine the number of bytes of Field5, and I think valueLength is the best/only option.

              dthompson David Thompson
              slawrence Steve Lawrence
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: