Details
-
Bug
-
Resolution: Duplicate
-
Blocking
-
None
-
None
-
None
Description
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.