1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var error_1 = require("../error");
- var escape_1 = require("../escape");
- var validate_1 = require("../validate");
- var XmlAttributeText = (function () {
- function XmlAttributeText(parent, validation, options) {
- this._validation = validation;
- if (!(0, validate_1.isUndefined)(options.replaceInvalidCharsInCharData)) {
- this._replaceInvalidCharsInCharData = (options.replaceInvalidCharsInCharData);
- }
- else {
- this._replaceInvalidCharsInCharData = false;
- }
- this._parent = parent;
- this.charData = options.charData;
- }
- Object.defineProperty(XmlAttributeText.prototype, "charData", {
-
- get: function () {
- return this._charData;
- },
-
- set: function (charData) {
- if (this._replaceInvalidCharsInCharData) {
- charData = (0, validate_1.fixChar)(charData);
- }
- else if (this._validation && !(0, validate_1.validateChar)(charData)) {
- throw new Error((0, error_1.getContext)(this.up()) + ": attribute text"
- + (" \"" + charData + "\" should not contain characters not")
- + " allowed in XML");
- }
- this._charData = charData;
- },
- enumerable: false,
- configurable: true
- });
-
- XmlAttributeText.prototype.toString = function () {
- var str = this._charData;
- str = (0, escape_1.escapeAmpersands)(str);
- str = (0, escape_1.escapeLeftAngleBrackets)(str);
- return str;
- };
-
- XmlAttributeText.prototype.up = function () {
- return this._parent;
- };
- return XmlAttributeText;
- }());
- exports.default = XmlAttributeText;
|