XMLDeclaration.js 1.5 KB

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