Rene Pijlman wrote:
The code below results in an exception (Python 2.4.2):
HTMLParser.HTMLParseError: bad end tag: /foo' + 'bar, at line 4,
column 6
Should it? The end tag it chokes on is in comment, isn't it?
no. STYLE and SCRIPT elements contain character data, not parsed
character
Fredrik Lundh:
Rene Pijlman:
[end tag in html comment in script element]
The end tag it chokes on is in comment, isn't it?
no. STYLE and SCRIPT elements contain character data, not parsed
character data, so comments are treated as characters, and the first
/ ends the element.
Ah, I see. I'll
Hello Rene,
You can also check out BeautifulSoup
(http://www.crummy.com/software/BeautifulSoup/) which is less strict
than the regular HTML parser.
HTH,
Miki
http://pythonwise.blogspot.com/
--
http://mail.python.org/mailman/listinfo/python-list
Miki:
You can also check out BeautifulSoup
(http://www.crummy.com/software/BeautifulSoup/) which is less strict
than the regular HTML parser.
Yes, thanks. Ik this case it was my sitechecker which checks for syntax
and broken links, so it was supposed to find the syntax error.
BeautifulSoup is not
Fredrik Lundh wrote:
Should it? The end tag it chokes on is in comment, isn't it?
no. STYLE and SCRIPT elements contain character data, not parsed
character data, so comments are treated as characters, and the first
/ ends the element.
Rather than take your word for it, I checked the W3C
Edward Elliott wrote:
Guess you learn something new every day. Too bad there's so much illegal
code in the wild. :(
if more people learned something new every day, the wild would look a
lot different.
/F
--
http://mail.python.org/mailman/listinfo/python-list
The code below results in an exception (Python 2.4.2):
HTMLParser.HTMLParseError: bad end tag: /foo' + 'bar, at line 4,
column 6
Should it? The end tag it chokes on is in comment, isn't it?
import HTMLParser
HTMLParser.HTMLParser().feed(
htmlheadtitle/title/headbodyscript
!--
x = '/foo' + 'bar'