pub fn xml_escape(s: &str) -> StringExpand description
Escape XML special characters in a string.
Replaces &, <, >, ", and ' with their XML entity equivalents.
Use this when embedding arbitrary text into XML attributes or text nodes to
prevent tag injection.
ยงExamples
use zeph_common::text::xml_escape;
assert_eq!(xml_escape("a < b && b > c"), "a < b && b > c");
assert_eq!(xml_escape(r#"say "hi""#), "say "hi"");
assert_eq!(xml_escape("it's"), "it's");