pyampact.symbolicUtils._escape_cdata
- pyampact.symbolicUtils._escape_cdata(text)[source]
Escape certain characters in a CDATA string for XML serialization.
This function checks if the input text is a CDATA string. If it is, the text is returned as is. If it’s not, the function escapes the characters “&”, “<”, and “>” by replacing them with their corresponding XML entities (”&”, “<”, and “>”).
This function is used to overwrite the default escape function in the xml.etree module. The default escape function does not escape characters in CDATA strings, which can cause XML serialization to fail.
Parameters: text (str): The input string to be escaped.
Returns: str: The escaped string, safe for XML serialization.
Raises: TypeError: If the input is not a string.