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

Function _escape_cdata_c14n

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

Source from the content-addressed store, hash-verified

2046
2047
2048def _escape_cdata_c14n(text):
2049 # escape character data
2050 try:
2051 # it's worth avoiding do-nothing calls for strings that are
2052 # shorter than 500 character, or so. assume that's, by far,
2053 # the most common case in most applications.
2054 if '&' in text:
2055 text = text.replace('&', '&')
2056 if '<' in text:
2057 text = text.replace('<', '&lt;')
2058 if '>' in text:
2059 text = text.replace('>', '&gt;')
2060 if '\r' in text:
2061 text = text.replace('\r', '&#xD;')
2062 return text
2063 except (TypeError, AttributeError):
2064 _raise_serialization_error(text)
2065
2066
2067def _escape_attrib_c14n(text):

Callers 4

_flushMethod · 0.85
_startMethod · 0.85
commentMethod · 0.85
piMethod · 0.85

Calls 2

replaceMethod · 0.45

Tested by

no test coverage detected