Skip to content

Instantly share code, notes, and snippets.

@zlalanne
zlalanne / Python-CDATA.py
Created June 5, 2013 05:48
Adds CDATA support to Python ElementTree
import xml.etree.ElementTree as ET
def CDATA(text=None):
element = ET.Element('![CDATA[')
element.text = text
return element
ET._original_serialize_xml = ET._serialize_xml