Handling quotes in xml.dom text nodes

Chaim Krause chaim at chaim.com
Tue Apr 13 11:52:44 EDT 2010

I am looking to find the best answer to my question, but in the mean
time I have resorted to monkey patching.

def _write_data_no_quote(writer, data):
    "Writes datachars to writer."
    data = data.replace("&", "&").replace("<", "<")
    data = data.replace(">", ">")

minidom._write_data = _write_data_no_quote

Maybe this is the best way to do this. I'm not sure.

More information about the Python-list mailing list