XFA - Create Form DOM in merging template and data trees

- Spec: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.364.2157&rep=rep1&type=pdf#page=171;
  - support for the 2 ways of merging: consumeData and matchTemplate;
  - create additional nodes in template DOM when occur node allows it;
  - support for global values in data DOM.
This commit is contained in:
Calixte Denizet 2021-02-24 19:05:04 +01:00
parent 5e3af62d58
commit 3243672727
9 changed files with 1584 additions and 109 deletions

View file

@ -13,14 +13,16 @@
* limitations under the License.
*/
import { $buildXFAObject, NamespaceIds } from "./namespaces.js";
import {
$appendChild,
$global,
$namespaceId,
$nodeName,
$onChildCheck,
$onChild,
XFAObject,
XmlObject,
} from "./xfa_object.js";
import { $buildXFAObject, NamespaceIds } from "./namespaces.js";
const DATASETS_NS_ID = NamespaceIds.datasets.id;
@ -37,15 +39,18 @@ class Datasets extends XFAObject {
this.Signature = null;
}
[$onChildCheck](child) {
[$onChild](child) {
const name = child[$nodeName];
if (name === "data") {
return child[$namespaceId] === DATASETS_NS_ID;
if (
(name === "data" && child[$namespaceId] === DATASETS_NS_ID) ||
(name === "Signature" &&
child[$namespaceId] === NamespaceIds.signature.id)
) {
this[name] = child;
} else {
child[$global] = true;
}
if (name === "Signature") {
return child[$namespaceId] === NamespaceIds.signature.id;
}
return false;
this[$appendChild](child);
}
}