XMLText.js 1006B

123456789101112131415161718192021222324252627282930313233
  1. // Generated by CoffeeScript 1.12.7
  2. (function() {
  3. var XMLNode, XMLText,
  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. XMLNode = require('./XMLNode');
  7. module.exports = XMLText = (function(superClass) {
  8. extend(XMLText, superClass);
  9. function XMLText(parent, text) {
  10. XMLText.__super__.constructor.call(this, parent);
  11. if (text == null) {
  12. throw new Error("Missing element text");
  13. }
  14. this.value = this.stringify.eleText(text);
  15. }
  16. XMLText.prototype.clone = function() {
  17. return Object.create(this);
  18. };
  19. XMLText.prototype.toString = function(options) {
  20. return this.options.writer.set(options).text(this);
  21. };
  22. return XMLText;
  23. })(XMLNode);
  24. }).call(this);