MCPcopy Create free account
hub / github.com/Sigil-Ebook/Sigil / xmlencode

Function xmlencode

src/Resource_Files/python3lib/opf_newparser.py:33–41  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

31
32# encode to make xml safe
33def xmlencode(data):
34 if data is None:
35 return ''
36 newdata = xmldecode(data)
37 newdata = newdata.replace('&', '&')
38 newdata = newdata.replace('<', '&lt;')
39 newdata = newdata.replace('>', '&gt;')
40 newdata = newdata.replace('"', '&quot;')
41 return newdata
42
43#decode xml encoded strings
44def xmldecode(data):

Calls 2

replaceMethod · 0.80
xmldecodeFunction · 0.70

Tested by

no test coverage detected