XMLDTDElement.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. // Generated by CoffeeScript 1.12.7
  2. (function() {
  3. var XMLDTDElement, XMLNode,
  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 = XMLDTDElement = (function(superClass) {
  8. extend(XMLDTDElement, superClass);
  9. function XMLDTDElement(parent, name, value) {
  10. XMLDTDElement.__super__.constructor.call(this, parent);
  11. if (name == null) {
  12. throw new Error("Missing DTD element name. " + this.debugInfo());
  13. }
  14. if (!value) {
  15. value = '(#PCDATA)';
  16. }
  17. if (Array.isArray(value)) {
  18. value = '(' + value.join(',') + ')';
  19. }
  20. this.name = this.stringify.eleName(name);
  21. this.value = this.stringify.dtdElementValue(value);
  22. }
  23. XMLDTDElement.prototype.toString = function(options) {
  24. return this.options.writer.set(options).dtdElement(this);
  25. };
  26. return XMLDTDElement;
  27. })(XMLNode);
  28. }).call(this);