[XML-SIG] elementtree and uncomplete parsing

Stefan Behnel stefan_ml at behnel.de
Sat Jun 21 12:02:06 CEST 2008


Jean-Marc Chourot wrote:
> The real problem is not about "badly formed HTML" : each node will
> correspond to a leaf of a wx.TreeCtrl and the data associated to the
> leaf will be the content of a wx.RichTextCtrl. When saving the whole
> tree content in one file, I want to be able to get the structure of the
> tree and relocate the data to each leaf and definitely not touch the
> content which is parse the wxrichTxtCtrl.

If I understand correctly, your XML-like string content comes from user input
in the RichTextCtrl. Meaning: when you copy it into the XML tree, it should
get escaped (i.e. '<' replaced by '&lt;' etc.). Then every XML parser will
read this as you expect.

ElementTree will do the escaping for you when you set the ".text" property of
a leaf node.

Or did you mean to say that wxPython saves the broken XML for you?


More information about the XML-SIG mailing list