Files

36 lines
1000 B
JavaScript
Raw Permalink Normal View History

2026-03-31 16:38:22 -07:00
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.XmlDeclaration = void 0;
const XmlNode_js_1 = require("./XmlNode.js");
/**
* An XML declaration within an XML document.
*
* @example
*
* ```xml
* <?xml version="1.0" encoding="UTF-8"?>
* ```
*/
class XmlDeclaration extends XmlNode_js_1.XmlNode {
constructor(version, encoding, standalone) {
super();
this.version = version;
this.encoding = encoding ?? null;
this.standalone = standalone ?? null;
}
get type() {
return XmlNode_js_1.XmlNode.TYPE_XML_DECLARATION;
}
toJSON() {
let json = XmlNode_js_1.XmlNode.prototype.toJSON.call(this);
json.version = this.version;
for (let key of ['encoding', 'standalone']) {
if (this[key] !== null) {
json[key] = this[key];
}
}
return json;
}
}
exports.XmlDeclaration = XmlDeclaration;
//# sourceMappingURL=XmlDeclaration.js.map