MCPcopy Create free account
hub / github.com/NaturalIntelligence/fast-xml-parser / addEntity

Method addEntity

src/xmlparser/XMLParser.js:46–56  ·  view source on GitHub ↗

* Add Entity which is not by default supported by this library * @param {string} key * @param {string} value

(key, value)

Source from the content-addressed store, hash-verified

44 * @param {string} value
45 */
46 addEntity(key, value) {
47 if (value.indexOf("&") !== -1) {
48 throw new Error("Entity value can't have '&'")
49 } else if (key.indexOf("&") !== -1 || key.indexOf(";") !== -1) {
50 throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'")
51 } else if (value === "&") {
52 throw new Error("An entity with value '&' is not permitted");
53 } else {
54 this.externalEntities[key] = value;
55 }
56 }
57
58 /**
59 * Returns a Symbol that can be used to access the metadata

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected