mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-29 07:37:57 +02:00
XFA - Created data node mustn't belong to datasets namespace
- when some named nodes in the template don't have their counterpart in datasets we create some nodes: the main node mustn't belong to the datasets namespace because it doesn't make sense and Acrobat Reader isn't able to read pdf with such nodes. - so created nodes under a datasets node have a namespaceId set to -1 and consequently when serialized no namespace prefix will appear.
This commit is contained in:
parent
804abb3786
commit
57ae3a5a76
4 changed files with 82 additions and 8 deletions
|
@ -23,6 +23,7 @@ import {
|
|||
XFAObjectArray,
|
||||
XmlObject,
|
||||
} from "./xfa_object.js";
|
||||
import { NamespaceIds } from "./namespaces.js";
|
||||
import { warn } from "../../shared/util.js";
|
||||
|
||||
const namePattern = /^[^.[]+/;
|
||||
|
@ -51,6 +52,7 @@ const shortcuts = new Map([
|
|||
]);
|
||||
|
||||
const somCache = new WeakMap();
|
||||
const NS_DATASETS = NamespaceIds.datasets.id;
|
||||
|
||||
function parseIndex(index) {
|
||||
index = index.trim();
|
||||
|
@ -261,7 +263,8 @@ function createNodes(root, path) {
|
|||
let node = null;
|
||||
for (const { name, index } of path) {
|
||||
for (let i = 0, ii = !isFinite(index) ? 0 : index; i <= ii; i++) {
|
||||
node = new XmlObject(root[$namespaceId], name);
|
||||
const nsId = root[$namespaceId] === NS_DATASETS ? -1 : root[$namespaceId];
|
||||
node = new XmlObject(nsId, name);
|
||||
root[$appendChild](node);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue