'Generate XML output of the node. If the text contains "]]>", then
escape it by going out of CDATA mode (]]>), then write the string
and then go into CDATA mode again. (<![CDATA[)'

def toXml(self, level, f):

    if self.data:
        f.write(('<![CDATA[%s]]>' % self.data.replace(']]>', ']]>]]><![CDATA[')))
