Repositorio del curso CCOM4030 el semestre B91 del proyecto Paz para la Mujer

XMLDTDEntity.js 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // Generated by CoffeeScript 1.12.7
  2. (function() {
  3. var XMLDTDEntity, XMLNode, isObject,
  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. isObject = require('./Utility').isObject;
  7. XMLNode = require('./XMLNode');
  8. module.exports = XMLDTDEntity = (function(superClass) {
  9. extend(XMLDTDEntity, superClass);
  10. function XMLDTDEntity(parent, pe, name, value) {
  11. XMLDTDEntity.__super__.constructor.call(this, parent);
  12. if (name == null) {
  13. throw new Error("Missing entity name");
  14. }
  15. if (value == null) {
  16. throw new Error("Missing entity value");
  17. }
  18. this.pe = !!pe;
  19. this.name = this.stringify.eleName(name);
  20. if (!isObject(value)) {
  21. this.value = this.stringify.dtdEntityValue(value);
  22. } else {
  23. if (!value.pubID && !value.sysID) {
  24. throw new Error("Public and/or system identifiers are required for an external entity");
  25. }
  26. if (value.pubID && !value.sysID) {
  27. throw new Error("System identifier is required for a public external entity");
  28. }
  29. if (value.pubID != null) {
  30. this.pubID = this.stringify.dtdPubID(value.pubID);
  31. }
  32. if (value.sysID != null) {
  33. this.sysID = this.stringify.dtdSysID(value.sysID);
  34. }
  35. if (value.nData != null) {
  36. this.nData = this.stringify.dtdNData(value.nData);
  37. }
  38. if (this.pe && this.nData) {
  39. throw new Error("Notation declaration is not allowed in a parameter entity");
  40. }
  41. }
  42. }
  43. XMLDTDEntity.prototype.toString = function(options) {
  44. return this.options.writer.set(options).dtdEntity(this);
  45. };
  46. return XMLDTDEntity;
  47. })(XMLNode);
  48. }).call(this);