Returns the replacement text of an external entity or an entity declared in
external markup declarations. Returns undefined for entity names with no
declaration.
Note that replacement text is not treated as literal plain text, it is
parsed as markup, so it may contain elements, character references, or
even other entity references.
If the entity value should be treated as literal plain text it should be
escaped with xmlEscape before returning it.
Example
getEntity(name) { if (name ==="foo") { // Parsed as start tag 'bar', entity ref 'baz', end tag 'bar' return"<bar>&baz;</bar>"; } if (name ==="boo") { // Parsed as the literal text '<bar>&baz;</bar>' returnxmlEscape("<bar>&baz;</bar>"); } returnundefined; }
Parameters
name: string
Name of the entity.
Returns string|undefined
Returns the replacement text of the specified entity.
Returns the replacement text of an external entity or an entity declared in external markup declarations. Returns
undefinedfor entity names with no declaration.Note that replacement text is not treated as literal plain text, it is parsed as markup, so it may contain elements, character references, or even other entity references.
If the entity value should be treated as literal plain text it should be escaped with
xmlEscapebefore returning it.Example