XFA subform with occur min=0 and no bound data displaying

Subfrom nomin displays even though it's subform is set to <occur max=-1 min=0>
If we look through specs of XFA 3.3 : https://www.pdfa.org/norm-refs/XFA-3_3.pdf
- The min attribute is used when processing a form that contains data. Regardless of the data at least this number of instances is included. It is permissible to set this value to zero, in which case the container is entirely excluded if there is no data for it.

However, in our case it doesn't happen, because we let our empty dataNode get through. Though by setting a clause:
- eliminate unmatched data with occur min=0
we are checking our empty data and sending it to uselessNode array where at the end it gets removed;
This commit is contained in:
Jane-Kotovich 2021-11-02 15:35:08 +10:00
parent 6a15973a1b
commit 56b502391c
4 changed files with 15 additions and 0 deletions

View File

@ -635,6 +635,13 @@ class Binder {
/* skipConsumed = */ this.emptyMerge
).next().value;
if (!match) {
// If there is no match (no data) and `min === 0` then
// the container is entirely excluded.
// https://www.pdfa.org/norm-refs/XFA-3_3.pdf#G12.1428332
if (min === 0) {
uselessNodes.push(child);
continue;
}
// We're in matchTemplate mode so create a node in data to reflect
// what we've in template.
const nsId =

View File

@ -213,6 +213,7 @@
!issue4402_reduced.pdf
!issue845r.pdf
!issue3405r.pdf
!issue14130.pdf
!issue7339_reduced.pdf
!issue3438.pdf
!issue11403_reduced.pdf

BIN
test/pdfs/issue14130.pdf Normal file

Binary file not shown.

View File

@ -4390,6 +4390,13 @@
"link": false,
"type": "eq"
},
{ "id": "issue14130",
"file": "pdfs/issue14130.pdf",
"md5": "82e7efb0a10122e793fc64348d93dc4e",
"enableXfa": true,
"rounds": 1,
"type": "eq"
},
{ "id": "issue6151",
"file": "pdfs/issue6151.pdf",
"md5": "926f8c6b25e6f0978759f7947d70e079",