MCPcopy Index your code
hub / github.com/RustPython/RustPython / _escape_attrib_c14n

Function _escape_attrib_c14n

Lib/xml/etree/ElementTree.py:2067–2084  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

2065
2066
2067def _escape_attrib_c14n(text):
2068 # escape attribute value
2069 try:
2070 if '&' in text:
2071 text = text.replace('&', '&')
2072 if '<' in text:
2073 text = text.replace('<', '&lt;')
2074 if '"' in text:
2075 text = text.replace('"', '&quot;')
2076 if '\t' in text:
2077 text = text.replace('\t', '&#x9;')
2078 if '\n' in text:
2079 text = text.replace('\n', '&#xA;')
2080 if '\r' in text:
2081 text = text.replace('\r', '&#xD;')
2082 return text
2083 except (TypeError, AttributeError):
2084 _raise_serialization_error(text)
2085
2086
2087# --------------------------------------------------------------------

Callers 1

_startMethod · 0.85

Calls 2

replaceMethod · 0.45

Tested by

no test coverage detected