1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
"""Tools for writing xml Suggestion for this module: create a simple xml writer here and expurgate all other modules of angle brackets entirely. """ def _escape_cdata(text): """Escape special characters in cdata. :note: This does not care about the input encoding, and supports both unicode and byte strings. """ text = text.replace("&", "&") text = text.replace("<", "<") text = text.replace(">", ">") return text |