How to quote XML to get the string with quoted control characters in python?
Source string:
<root namespace="value" id="guid">
<child name="child1">Content</child>
</root>
Result string:
<root namespace=\"value\" id=\"guid\">\n <child name=\"child1\">Content<\/child><\/root>
You can find information about how to escape/unscape xml entities in the
python.orgwiki. In particular, there’s a section about quoting attributes withxml.sax.saxutils.quoteattrwhich seems to be what you’re looking for.