/// Performs escaping of common XML characters inside an attribute value. /// /// This function replaces several important markup characters with their /// entity equivalents: /// /// * `<` → `<` /// * `>` → `>` /// * `"` → `"` /// * `'` → `'` /// * `&` → `&` /// /// The resulting string is safe to use inside XML attribute values or in PCDATA sections. /// /// Does not perform allocations if the given string does not contain escapable characters. #[inline] pubfn escape_str_attribute(s: &str) -> Cow<str> {
escape_str(s, Value::dispatch_for_attribute)
}
/// Performs escaping of common XML characters inside PCDATA. /// /// This function replaces several important markup characters with their /// entity equivalents: /// /// * `<` → `<` /// * `&` → `&` /// /// The resulting string is safe to use inside PCDATA sections but NOT inside attribute values. /// /// Does not perform allocations if the given string does not contain escapable characters. #[inline] pubfn escape_str_pcdata(s: &str) -> Cow<str> {
escape_str(s, Value::dispatch_for_pcdata)
}
#[cfg(test)] mod tests { usesuper::{escape_str_pcdata, escape_str_attribute};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.