3 Nov
2020
3 Nov
'20
4:22 p.m.
Hi, when changing the text of an element, the CDATA section gets stripped away. I'm aware of the CDATA class, but I only want to apply it if the element had a CDATA section before the text change. I'm also already parsing the XML data with 'strip_cdata=False'. Something like: newText = someTransformation(element.text) element.text = CDATA(newText) if hasCDATA(element) else newText But I can't figure out how to do the detection of 'hasCDATA'. Thanks for any hints! Greetings, Daniel