pub fn normalize_attribute_value<'input, 'entity, C, E, F>(
value: &'input str,
depth: usize,
is_normalization_char: C,
normalize_eol_step: E,
resolve_entity: F,
) -> Result<Cow<'input, str>, EscapeError>Expand description
Returns the attribute value normalized as per the XML specification, using a custom entity resolver.
Do not use this method with HTML attributes.
Escape sequences such as > are replaced with their unescaped equivalents such as >
and the characters \t, \r, \n are replaced with whitespace characters. A function
for resolving entities can be provided as resolve_entity. Builtin entities will still
take precedence.
This will allocate unless the raw attribute value does not require normalization.
§Parameters
value: unnormalized attribute valuedepth: maximum number of nested entities that can be expanded. If expansion chain will be more that this value, the function will returnEscapeError::TooManyNestedEntitiesis_normalization_char: a function to check if byte is the start byte of character that should be normalized (UTF-8 encoding is assumed)normalize_eol_step: a function that performs EOL normalization of a characterresolve_entity: a function to resolve entity. This function could be called multiple times on the same input and can return different values in each case for the same input, although it is not recommended
§Lifetimes
'input: lifetime of the unnormalized attribute. If normalization is not required, the input returned unchanged with the same lifetime'entity: lifetime of all entities that is returned by the entity resolution routine