Python ElementTree unescapes HTML entities



I wrote a simple script that parses XML into a comma-delimited format. A sample of the XML source is in this gist and the code for the parser is in this gist.


My problem is that when I get the value of the AboutMe attribute, cElementTree is unescaping the HTML contained in that attribute. Ideally, I would like to keep the format as escaped HTML and simply wrap it in quotes for the output file. But I'm getting the un-escaped string instead, as seen in this gist. How do I tell cElementTree to maintain the original value of the attribute and not transform it to HTML?


No comments:

Post a Comment