mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 01:58:06 +02:00
[Acroform] Use the full path to find the node in the XFA datasets where to store the value
I noticed several 'Path not found' errors because of a field called #subform[2]. From the XFA specs, the hash is used for a class of elements in the template tree. When we're looking for a node in the datasets tree, it doesn't make sense to search for a class. Hence the path element starting with a hash are just skipped.
This commit is contained in:
parent
e676c9388d
commit
3a21423386
8 changed files with 135 additions and 5 deletions
|
@ -139,7 +139,12 @@ function writeXFADataForAcroform(str, newRefs) {
|
|||
if (!path) {
|
||||
continue;
|
||||
}
|
||||
const node = xml.documentElement.searchNode(parseXFAPath(path), 0);
|
||||
const nodePath = parseXFAPath(path);
|
||||
let node = xml.documentElement.searchNode(nodePath, 0);
|
||||
if (!node && nodePath.length > 1) {
|
||||
// If we're lucky the last element in the path will identify the node.
|
||||
node = xml.documentElement.searchNode([nodePath.at(-1)], 0);
|
||||
}
|
||||
if (node) {
|
||||
if (Array.isArray(value)) {
|
||||
node.childNodes = value.map(val => new SimpleDOMNode("value", val));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue