You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

XMLDTDNotation.js 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // Generated by CoffeeScript 2.4.1
  2. (function() {
  3. var NodeType, XMLDTDNotation, XMLNode;
  4. XMLNode = require('./XMLNode');
  5. NodeType = require('./NodeType');
  6. // Represents a NOTATION entry in the DTD
  7. module.exports = XMLDTDNotation = (function() {
  8. class XMLDTDNotation extends XMLNode {
  9. // Initializes a new instance of `XMLDTDNotation`
  10. // `parent` the parent `XMLDocType` element
  11. // `name` the name of the notation
  12. // `value` an object with external entity details
  13. // `value.pubID` public identifier
  14. // `value.sysID` system identifier
  15. constructor(parent, name, value) {
  16. super(parent);
  17. if (name == null) {
  18. throw new Error("Missing DTD notation name. " + this.debugInfo(name));
  19. }
  20. if (!value.pubID && !value.sysID) {
  21. throw new Error("Public or system identifiers are required for an external entity. " + this.debugInfo(name));
  22. }
  23. this.name = this.stringify.name(name);
  24. this.type = NodeType.NotationDeclaration;
  25. if (value.pubID != null) {
  26. this.pubID = this.stringify.dtdPubID(value.pubID);
  27. }
  28. if (value.sysID != null) {
  29. this.sysID = this.stringify.dtdSysID(value.sysID);
  30. }
  31. }
  32. // Converts the XML fragment to string
  33. // `options.pretty` pretty prints the result
  34. // `options.indent` indentation for pretty print
  35. // `options.offset` how many indentations to add to every line for pretty print
  36. // `options.newline` newline sequence for pretty print
  37. toString(options) {
  38. return this.options.writer.dtdNotation(this, this.options.writer.filterOptions(options));
  39. }
  40. };
  41. // DOM level 1
  42. Object.defineProperty(XMLDTDNotation.prototype, 'publicId', {
  43. get: function() {
  44. return this.pubID;
  45. }
  46. });
  47. Object.defineProperty(XMLDTDNotation.prototype, 'systemId', {
  48. get: function() {
  49. return this.sysID;
  50. }
  51. });
  52. return XMLDTDNotation;
  53. }).call(this);
  54. }).call(this);