Blame view

node_modules/xmlcreate/lib/nodes/XmlDtdNotation.js 4.13 KB
f7563de62   Palak Handa   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
  "use strict";
  var __extends = (this && this.__extends) || (function () {
      var extendStatics = Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
          function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
      return function (d, b) {
          extendStatics(d, b);
          function __() { this.constructor = d; }
          d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
      };
  })();
  Object.defineProperty(exports, "__esModule", { value: true });
  var utils_1 = require("../utils");
  var validate_1 = require("../validate");
  var XmlNode_1 = require("./XmlNode");
  /**
   * Represents an XML notation declaration in a document type definition.
   *
   * An XML notation declaration is structured as follows, where `{text}` is the
   * text of the declaration:
   *
   * ```xml
   * <!NOTATION {text}>
   * ```
   *
   * The `{text}` value is a property of this node.
   *
   * XmlDtdNotation nodes cannot have any children.
   */
  var XmlDtdNotation = (function (_super) {
      __extends(XmlDtdNotation, _super);
      /**
       * Initializes a new instance of the {@link XmlDtdNotation} class.
       *
       * @param text The text associated with the XML notation declaration.
       */
      function XmlDtdNotation(text) {
          var _this = _super.call(this) || this;
          _this.text = text;
          return _this;
      }
      Object.defineProperty(XmlDtdNotation.prototype, "text", {
          /**
           * Gets the text associated with the XML notation declaration.
           *
           * @return The text associated with the XML notation declaration.
           */
          get: function () {
              return this._text;
          },
          /**
           * Sets the text associated with the XML notation declaration.
           *
           * @param text The text associated with the XML notation declaration.
           */
          set: function (text) {
              if (!utils_1.isString(text)) {
                  throw new TypeError("text should be a string");
              }
              else if (!validate_1.validateChar(text)) {
                  throw new Error("data should not contain characters"
                      + " not allowed in XML");
              }
              this._text = text;
          },
          enumerable: true,
          configurable: true
      });
      /**
       * Throws an exception since {@link XmlDtdNotation} nodes cannot have any
       * children.
       *
       * @returns This method does not return.
       */
      XmlDtdNotation.prototype.children = function () {
          throw new Error("XmlDtdNotation nodes cannot have children");
      };
      /**
       * Throws an exception since {@link XmlDtdNotation} nodes cannot have any
       * children.
       *
       * @param node This parameter is unused.
       * @param index This parameter is unused.
       *
       * @returns This method does not return.
       */
      XmlDtdNotation.prototype.insertChild = function (node, index) {
          throw new Error("XmlDtdNotation nodes cannot have children");
      };
      /**
       * Throws an exception since {@link XmlDtdNotation} nodes cannot have any
       * children.
       *
       * @param node This parameter is unused.
       *
       * @returns This method does not return.
       */
      XmlDtdNotation.prototype.removeChild = function (node) {
          throw new Error("XmlDtdNotation nodes cannot have children");
      };
      /**
       * Throws an exception since {@link XmlDtdNotation} nodes cannot have any
       * children.
       *
       * @param index This parameter is unused.
       *
       * @returns This method does not return.
       */
      XmlDtdNotation.prototype.removeChildAtIndex = function (index) {
          throw new Error("XmlDtdNotation nodes cannot have children");
      };
      /**
       * Returns an XML string representation of this node.
       *
       * @param options Formatting options for the string representation.
       *
       * @returns An XML string representation of this node.
       */
      XmlDtdNotation.prototype.toString = function (options) {
          if (options === void 0) { options = {}; }
          return "<!NOTATION " + this.text + ">";
      };
      return XmlDtdNotation;
  }(XmlNode_1.default));
  exports.default = XmlDtdNotation;