<xml>
<maintag>
<content> lorem <br>ipsum</br> <strong> dolor sit </strong> and so on </content>
</maintag>
</xml>
The xml file that i regularly parse, may have html tags inside of content tag as shown above.
Here how i parse the file:
parser = etree.XMLParser(remove_blank_text=False)
tree = etree.parse(StringIO(xmlFile), parser)
for item in tree.iter('maintag'):
my_content = item.find('content').text
#print my_content
#output: lorem
as a result it results my_content = 'lorem' instead of -which i'd like to see- ' lorem < br >ipsum< /br> < strong > dolor sit < /strong > and so on'
How can i read the content as ' lorem < br>ipsum< /br> < strong > dolor sit < /strong > and so on'?
Note: content tag may have another html tags instead of strong. And may not have them at all.
prints
prints