Bug: Tidy can handle this but BeautifulSoup can't (YET :P)

11 views
Skip to first unread message

All Marx

unread,
Nov 12, 2009, 7:54:30 PM11/12/09
to beautifulsoup
So this is more of a bug of the terrible HTML author of a document I
needed to parse. But basically, the following will break the parser
and not give the expected results:

>>>
from BeautifulSoup import BeautifulSoup

html = '''
<table>
<tr>
<td height="20">This element is fine</td>
<td class = "xyz"width="200">This one hacks the gibson</td>
<td>I won't be seen :(</td>
</tr>
</table>
'''

s = BeautifulSoup(html)
print s.prettify()

>>>
<table>
<tr>
<td height="20">
This element is fine
</td>
</tr>
</table>
>>>


So you notice how the spacing between the = sign and the attribute,
and also how the " quote touches another attribute.

Anyways thought I'd let you guys know so you can fix it, Tidy was able
to handle this error.

Aaron DeVore

unread,
Nov 13, 2009, 12:21:16 PM11/13/09
to beauti...@googlegroups.com
All Marx,

Try out Beautiful Soup 3.0.7a or the version at Git Hub. That HTML
parses correctly in the 3.0.x series, but not the 3.1.x series.

-Aaron
> --
>
> You received this message because you are subscribed to the Google Groups "beautifulsoup" group.
> To post to this group, send email to beauti...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/beautifulsoup?hl=.
>
>
>
Reply all
Reply to author
Forward
0 new messages