00001
00002 (function() {
00003 var XMLDeclaration, XMLNode, isObject,
00004 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; },
00005 hasProp = {}.hasOwnProperty;
00006
00007 isObject = require('./Utility').isObject;
00008
00009 XMLNode = require('./XMLNode');
00010
00011 module.exports = XMLDeclaration = (function(superClass) {
00012 extend(XMLDeclaration, superClass);
00013
00014 function XMLDeclaration(parent, version, encoding, standalone) {
00015 var ref;
00016 XMLDeclaration.__super__.constructor.call(this, parent);
00017 if (isObject(version)) {
00018 ref = version, version = ref.version, encoding = ref.encoding, standalone = ref.standalone;
00019 }
00020 if (!version) {
00021 version = '1.0';
00022 }
00023 this.version = this.stringify.xmlVersion(version);
00024 if (encoding != null) {
00025 this.encoding = this.stringify.xmlEncoding(encoding);
00026 }
00027 if (standalone != null) {
00028 this.standalone = this.stringify.xmlStandalone(standalone);
00029 }
00030 }
00031
00032 XMLDeclaration.prototype.toString = function(options) {
00033 return this.options.writer.set(options).declaration(this);
00034 };
00035
00036 return XMLDeclaration;
00037
00038 })(XMLNode);
00039
00040 }).call(this);