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

3
  • Here is a similar question with several answers: stackoverflow.com/questions/174890/… Commented Dec 1, 2016 at 9:49
  • It might not help you, but if CDATA is important to you, then CDATA is being misused. Writing <a><![CDATA[xxx]]></a> should be 100% equivalent to writing <a>xxx</a> which is why most XML APIs won't distinguish the two in the data they pass to the application. Commented Dec 1, 2016 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. Commented Dec 2, 2016 at 7:51

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.