MCPcopy Index your code
hub / github.com/python/cpython / _escape_attrib_c14n

Function _escape_attrib_c14n

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

Source from the content-addressed store, hash-verified

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

Callers 1

_startMethod · 0.85

Calls 2

replaceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…