Repositorio del curso CCOM4030 el semestre B91 del proyecto Paz para la Mujer

XMLDocument.js 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Generated by CoffeeScript 1.12.7
  2. (function() {
  3. var XMLDocument, XMLNode, XMLStringWriter, XMLStringifier, isPlainObject,
  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. isPlainObject = require('./Utility').isPlainObject;
  7. XMLNode = require('./XMLNode');
  8. XMLStringifier = require('./XMLStringifier');
  9. XMLStringWriter = require('./XMLStringWriter');
  10. module.exports = XMLDocument = (function(superClass) {
  11. extend(XMLDocument, superClass);
  12. function XMLDocument(options) {
  13. XMLDocument.__super__.constructor.call(this, null);
  14. options || (options = {});
  15. if (!options.writer) {
  16. options.writer = new XMLStringWriter();
  17. }
  18. this.options = options;
  19. this.stringify = new XMLStringifier(options);
  20. this.isDocument = true;
  21. }
  22. XMLDocument.prototype.end = function(writer) {
  23. var writerOptions;
  24. if (!writer) {
  25. writer = this.options.writer;
  26. } else if (isPlainObject(writer)) {
  27. writerOptions = writer;
  28. writer = this.options.writer.set(writerOptions);
  29. }
  30. return writer.document(this);
  31. };
  32. XMLDocument.prototype.toString = function(options) {
  33. return this.options.writer.set(options).document(this);
  34. };
  35. return XMLDocument;
  36. })(XMLNode);
  37. }).call(this);