3 var XMLDeclaration, XMLNode, isObject,
4 extend =
function(child, parent) {
for (var key in parent) {
if (hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype =
new ctor(); child.__super__ = parent.prototype;
return child; },
5 hasProp = {}.hasOwnProperty;
7 isObject = require(
'./Utility').isObject;
9 XMLNode = require(
'./XMLNode');
11 module.exports = XMLDeclaration = (
function(superClass) {
12 extend(XMLDeclaration, superClass);
14 function XMLDeclaration(parent, version, encoding, standalone) {
16 XMLDeclaration.__super__.constructor.call(
this, parent);
17 if (isObject(version)) {
18 ref = version, version = ref.version, encoding = ref.encoding, standalone = ref.standalone;
23 this.version = this.stringify.xmlVersion(version);
24 if (encoding != null) {
25 this.encoding = this.stringify.xmlEncoding(encoding);
27 if (standalone != null) {
28 this.standalone = this.stringify.xmlStandalone(standalone);
32 XMLDeclaration.prototype.toString =
function(options) {
33 return this.options.writer.set(options).declaration(
this);
36 return XMLDeclaration;