Skip to main content

normalize_string_value

Function normalize_string_value 

Source
pub fn normalize_string_value(
    value: &str,
    is_attr: bool,
    raise_on_error: bool,
) -> Result<String, XPathError>
Expand description

Normalize a string value with entity reference handling.

Handles standard XML entity references:

  • &lt; -> <
  • &gt; -> >
  • &amp; -> &
  • &quot; -> "
  • &apos; -> '
  • &#xNN; -> character by hex code
  • &#NN; -> character by decimal code

§Arguments

  • value - The string to normalize
  • is_attr - Whether this is an attribute value (applies additional normalization)
  • raise_on_error - Whether to raise an error on invalid entity references

§Returns

The normalized string, or an error for invalid entity references.