Attila, It took me a bit to spot this, and I'm really not sure I am correct here.
I think you need one more sequence. If you insert another element of type "TailType-perstempo" at the end, it doesn't want to be inside the sequence with NL infix separators. It wants to be after that sequence has ended, but inside a surrounding sequence that is the model group of the complexType of the csv-version4... element, but which has no separators. Given the images you provided, I can't cut/paste to try this theory out. I would like to make self-contained TDML files be the way we all exchange examples/bug-reports. Could you make a TDML file? (See https://daffodil.apache.org/tdml/) Their beauty is that they can be fully self-contained, i.e., contain schema, data, and expected results all together. Everything to reproduce can be in the same file. -mikeb ________________________________ From: Attila Horvath <attila.j.horv...@gmail.com> Sent: Monday, June 21, 2021 1:27 PM To: users@daffodil.apache.org <users@daffodil.apache.org> Subject: how to incorporate file terminator into generic CSV schema? I have following generic variable field/record length schema which daffodil 2.4.0 parses/unparses verbatim except "No newline at end of file" error when I diff original CSV against reconstituted CSV. Otherwise reconstituted CSV appears to match original CSV:... [image.png] To get around this I've tried/failed to incorporate code block in RED into code block in YELLOW (see code block image). I've used code block in RED successfully but not w/ variable fields/records CSV via "...fn:count...". Can someone pls suggest how to correctly integrate unknown file terminator into code block in YELLOW in this schema? [image.png] Thx in advance, Attila