Expand description
Manage XML character escapes.
This module mirrors quick-xml 0.41 escape: escape, partial_escape
and minimal_escape replace XML special characters with entity references,
while unescape / unescape_with reverse the process. Predefined XML
entities are resolved by resolve_predefined_entity; with the escape-html
feature enabled, the full set of HTML5 named references is recognized instead.
Enums§
- Escape
Error - Error for XML escape / unescape.
- Parse
Char RefError - Error while parsing a character reference (
&#<dec-number>;or&#x<hex-number>;).
Functions§
- escape
- Escapes an
&str, replacing all XML special characters (<,>,&,',") with their corresponding XML escape sequences. - minimal_
escape - Escapes an
&str, replacing only the characters (<and&) that the XML standard requires to be escaped in text content and attribute values. - normalize_
attribute_ value - Returns the attribute value normalized as per the XML specification, using a custom entity resolver.
- partial_
escape - Escapes an
&str, replacing the XML special characters<,>and&. - resolve_
html5_ entity escape-html - Resolves all HTML5 entities. For the complete list see https://dev.w3.org/html5/html-author/charref.
- resolve_
predefined_ entity - Resolves predefined XML entities, or all HTML5 entities when the
escape-htmlfeature is enabled. - resolve_
xml_ entity - Resolves the five predefined XML entities. Returns
Nonefor any other name. - unescape
- Unescapes an
&str, replacing all XML escapes (&...;) with their corresponding value. - unescape_
with - Unescapes an
&str, replacing all XML escapes (&...;) with their corresponding value, usingresolve_entityfor named entities.