Function quick_xml::escape::resolve_xml_entity

source ยท
pub const fn resolve_xml_entity(entity: &str) -> Option<&'static str>
Expand description

Resolves predefined XML entities. If specified entity is not a predefined XML entity, None is returned.

The complete list of predefined entities are defined in the specification.

assert_eq!(resolve_xml_entity("lt"), Some("<"));
assert_eq!(resolve_xml_entity("gt"), Some(">"));
assert_eq!(resolve_xml_entity("amp"), Some("&"));
assert_eq!(resolve_xml_entity("apos"), Some("'"));
assert_eq!(resolve_xml_entity("quot"), Some("\""));

assert_eq!(resolve_xml_entity("foo"), None);