2

I need to find all elements which contain CDATA. I iterate through the entire tree.
The problem is, ElementTree strips CDATA tag, leaving no trace. Is there a similar solution to nodeType or CDATASection from xml.dom?
Thanks

Jakub Čech
  • 49
  • 1
  • 7
  • Here is a similar question with several answers: http://stackoverflow.com/questions/174890/how-to-output-cdata-using-elementtree – mzjn Dec 01 '16 at 09:49
  • It might not help you, but if CDATA is important to you, then CDATA is being misused. Writing `<![CDATA[xxx]]>` should be 100% equivalent to writing `xxx` which is why most XML APIs won't distinguish the two in the data they pass to the application. – Michael Kay Dec 01 '16 at 11:11
  • 1
    I'm trying to fix some files. An attribute got changed to CDATA text somehow. So I need to know if it is the cdata value or not. – Jakub Čech Dec 02 '16 at 07:51

0 Answers0