Function marc::xml::escape_xml
source · pub fn escape_xml(value: &str, is_attr: bool) -> String
Expand description
Replace non-ASCII characters and special characters with escaped XML entities.
- is_attr - If true, also escape single and double quotes.
use marc::xml;
assert_eq!(xml::escape_xml("<'É'>", false).as_str(), "<'É'>");
assert_eq!(xml::escape_xml("<'É'>", true).as_str(), "<'É'>");