Parse text of element with empty element inside

Posted by Mando on Stack Overflow See other posts from Stack Overflow or by Mando
Published on 2010-06-02T17:20:33Z Indexed on 2010/06/02 17:24 UTC
Read the original article Hit count: 144

Filed under:
|

I'm trying to convert an XHTML document that uses lots of tables into a semantic XML document in Python using xml.etree. However, I'm having some trouble converting this XHTML

<TD>
  Textline1<BR/>
  Textline2<BR/>
  Textline3
</TD>

into something like this

<lines>
  <line>Textline1</line>
  <line>Textline2</line>
  <line>Textline3</line>
</lines>

The problem is that I don't know how to get the text after the BR elements.

© Stack Overflow or respective owner

Related posts about python

Related posts about Xml