* Add Entity which is not by default supported by this library * @param {string} key * @param {string} value
(key, value)
| 65 | * @param {string} value |
| 66 | */ |
| 67 | addEntity(key, value) { |
| 68 | if (value.indexOf("&") !== -1) { |
| 69 | throw new Error("Entity value can't have '&'") |
| 70 | } else if (key.indexOf("&") !== -1 || key.indexOf(";") !== -1) { |
| 71 | throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'") |
| 72 | } else if (value === "&") { |
| 73 | throw new Error("An entity with value '&' is not permitted"); |
| 74 | } else { |
| 75 | this.externalEntities[key] = value; |
| 76 | } |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | function isStream(stream) { |