2
0

datasets.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /**
  2. * @licstart The following is the entire license notice for the
  3. * JavaScript code in this page
  4. *
  5. * Copyright 2022 Mozilla Foundation
  6. *
  7. * Licensed under the Apache License, Version 2.0 (the "License");
  8. * you may not use this file except in compliance with the License.
  9. * You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS,
  15. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. * See the License for the specific language governing permissions and
  17. * limitations under the License.
  18. *
  19. * @licend The above is the entire license notice for the
  20. * JavaScript code in this page
  21. */
  22. "use strict";
  23. Object.defineProperty(exports, "__esModule", {
  24. value: true
  25. });
  26. exports.DatasetsNamespace = void 0;
  27. var _xfa_object = require("./xfa_object.js");
  28. var _namespaces = require("./namespaces.js");
  29. const DATASETS_NS_ID = _namespaces.NamespaceIds.datasets.id;
  30. class Data extends _xfa_object.XmlObject {
  31. constructor(attributes) {
  32. super(DATASETS_NS_ID, "data", attributes);
  33. }
  34. [_xfa_object.$isNsAgnostic]() {
  35. return true;
  36. }
  37. }
  38. class Datasets extends _xfa_object.XFAObject {
  39. constructor(attributes) {
  40. super(DATASETS_NS_ID, "datasets", true);
  41. this.data = null;
  42. this.Signature = null;
  43. }
  44. [_xfa_object.$onChild](child) {
  45. const name = child[_xfa_object.$nodeName];
  46. if (name === "data" && child[_xfa_object.$namespaceId] === DATASETS_NS_ID || name === "Signature" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.signature.id) {
  47. this[name] = child;
  48. }
  49. this[_xfa_object.$appendChild](child);
  50. }
  51. }
  52. class DatasetsNamespace {
  53. static [_namespaces.$buildXFAObject](name, attributes) {
  54. if (DatasetsNamespace.hasOwnProperty(name)) {
  55. return DatasetsNamespace[name](attributes);
  56. }
  57. return undefined;
  58. }
  59. static datasets(attributes) {
  60. return new Datasets(attributes);
  61. }
  62. static data(attributes) {
  63. return new Data(attributes);
  64. }
  65. }
  66. exports.DatasetsNamespace = DatasetsNamespace;