Skip to main content

xml_escape

Function xml_escape 

Source
pub fn xml_escape(s: &str) -> String
Expand description

Escape XML special characters in a string for safe SOAP payload interpolation.

Replaces &, <, >, ", and ' with their XML entity equivalents.

Delegates to quick_xml::escape::escape, whose predicate is exactly those five characters. Notably not partial_escape, which leaves " and ' alone and would therefore be unsafe for values interpolated in attribute position. Whitespace is left verbatim: escape’s predicate never matches space or tab, so the numeric-reference arms inside quick-xml’s shared _escape helper (which exist for xs:list delimiters) are unreachable from here. That matters because SOAP payloads carry track titles and URIs where &#32; would corrupt the value.