[lxml] Re: Adding HTML inside XML

2022-08-18 Thread Adrian Bool
Hi Karl, You're not parsing the context_string as XML or HTML; so lxml will be thinking its just some text that looks horribly like XML but is not XML and therefore needs to be escaped to be included within XML. The following: import lxml.etree as etree content_text = 'line oneline two' en_no

[lxml] Adding HTML inside XML

2022-08-18 Thread karl
Hello, I need to add some HTML inside XML. The result should look like this: the code i'm using is this: # read html from file - result is : content_text = 'line oneline two' en_note_el = etree.Element('en-note') en_note_el.text = content_text en_note_doctype = 'h