[Tutor] module to parse XMLish text?

Wayne Werner waynejwerner at gmail.com
Sat Jan 15 03:25:51 CET 2011


On Fri, Jan 14, 2011 at 4:42 PM, Terry Carroll <carroll at tjc.com> wrote:

> <snip>
>
> On Fri, 14 Jan 2011, Karim wrote:
>
>  from xml.etree.ElementTree import ElementTree
>>
>
> I don't think straight XML parsing will work on this, as it's not valid
> XML; it just looks XML-like enough to cause confusion.
>
>
It's worth trying out - most (good) parsers "do the right thing" even when
they don't have strictly valid code. I don't know if xml.etree is one, but
I'm fairly sure both lxml and BeautifulSoup would probably parse it
correctly. Only one way to find out ;)

-Wayne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110114/cfb53791/attachment-0001.html>


More information about the Tutor mailing list