XMLDTDNotation.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Generated by CoffeeScript 1.12.7
  2. (function() {
  3. var NodeType, 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. NodeType = require('./NodeType');
  8. module.exports = XMLDTDNotation = (function(superClass) {
  9. extend(XMLDTDNotation, superClass);
  10. function XMLDTDNotation(parent, name, value) {
  11. XMLDTDNotation.__super__.constructor.call(this, parent);
  12. if (name == null) {
  13. throw new Error("Missing DTD notation name. " + this.debugInfo(name));
  14. }
  15. if (!value.pubID && !value.sysID) {
  16. throw new Error("Public or system identifiers are required for an external entity. " + this.debugInfo(name));
  17. }
  18. this.name = this.stringify.name(name);
  19. this.type = NodeType.NotationDeclaration;
  20. if (value.pubID != null) {
  21. this.pubID = this.stringify.dtdPubID(value.pubID);
  22. }
  23. if (value.sysID != null) {
  24. this.sysID = this.stringify.dtdSysID(value.sysID);
  25. }
  26. }
  27. Object.defineProperty(XMLDTDNotation.prototype, 'publicId', {
  28. get: function() {
  29. return this.pubID;
  30. }
  31. });
  32. Object.defineProperty(XMLDTDNotation.prototype, 'systemId', {
  33. get: function() {
  34. return this.sysID;
  35. }
  36. });
  37. XMLDTDNotation.prototype.toString = function(options) {
  38. return this.options.writer.dtdNotation(this, this.options.writer.filterOptions(options));
  39. };
  40. return XMLDTDNotation;
  41. })(XMLNode);
  42. }).call(this);