Resolved: Parsing XML document that includes another XML document embedded in a CDATA section

In this post, we will see how to resolve Parsing XML document that includes another XML document embedded in a CDATA section

Question:

I’m trying out web scraping for the first time using lxml.etree. The website I want to scrape has an XML feed, which I can read fine, except for a part of its XML which is embedded within a CDATA section:
The problem the XML code in the CDATA section is weirdly indented, meaning that if I just pass the CDATA content into a string and then read it with etree (like I do below), I get a message error because of indentation.
This is the message:
at least based on the xml in the question. Not sure why you get the error you are showing.
The solution is to ask the source of the feed to fix the xml so it’s well formed.

If you have better answer, please add a comment about this, thank you!

Source: Stackoverflow.com