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

Method addEntity

src/xmlparser/XMLParser.js:52–62  ·  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

50 * @param {string} value
51 */
52 addEntity(key, value) {
53 if (value.indexOf("&") !== -1) {
54 throw new Error("Entity value can't have '&'")
55 } else if (key.indexOf("&") !== -1 || key.indexOf(";") !== -1) {
56 throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'")
57 } else if (value === "&") {
58 throw new Error("An entity with value '&' is not permitted");
59 } else {
60 this.externalEntities[key] = value;
61 }
62 }
63
64 /**
65 * 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