XMLDTDNotation.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // Generated by CoffeeScript 1.12.7
  2. (function() {
  3. var XMLDTDNotation, 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 = XMLDTDNotation = (function(superClass) {
  8. extend(XMLDTDNotation, superClass);
  9. function XMLDTDNotation(parent, name, value) {
  10. XMLDTDNotation.__super__.constructor.call(this, parent);
  11. if (name == null) {
  12. throw new Error("Missing DTD notation name. " + this.debugInfo(name));
  13. }
  14. if (!value.pubID && !value.sysID) {
  15. throw new Error("Public or system identifiers are required for an external entity. " + this.debugInfo(name));
  16. }
  17. this.name = this.stringify.eleName(name);
  18. if (value.pubID != null) {
  19. this.pubID = this.stringify.dtdPubID(value.pubID);
  20. }
  21. if (value.sysID != null) {
  22. this.sysID = this.stringify.dtdSysID(value.sysID);
  23. }
  24. }
  25. XMLDTDNotation.prototype.toString = function(options) {
  26. return this.options.writer.set(options).dtdNotation(this);
  27. };
  28. return XMLDTDNotation;
  29. })(XMLNode);
  30. }).call(this);