XMLDeclaration.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Generated by CoffeeScript 1.12.7
  2. (function() {
  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;
  6. isObject = require('./Utility').isObject;
  7. XMLNode = require('./XMLNode');
  8. module.exports = XMLDeclaration = (function(superClass) {
  9. extend(XMLDeclaration, superClass);
  10. function XMLDeclaration(parent, version, encoding, standalone) {
  11. var ref;
  12. XMLDeclaration.__super__.constructor.call(this, parent);
  13. if (isObject(version)) {
  14. ref = version, version = ref.version, encoding = ref.encoding, standalone = ref.standalone;
  15. }
  16. if (!version) {
  17. version = '1.0';
  18. }
  19. this.version = this.stringify.xmlVersion(version);
  20. if (encoding != null) {
  21. this.encoding = this.stringify.xmlEncoding(encoding);
  22. }
  23. if (standalone != null) {
  24. this.standalone = this.stringify.xmlStandalone(standalone);
  25. }
  26. }
  27. XMLDeclaration.prototype.toString = function(options) {
  28. return this.options.writer.set(options).declaration(this);
  29. };
  30. return XMLDeclaration;
  31. })(XMLNode);
  32. }).call(this);