Minor mistake on HTMLParser docs
Aug. 5, 2013
9:13 p.m.
Greetings, There's a minor mistake on the doc page for the HTMLParser module<http://docs.python.org/2/library/htmlparser.html> . The last snippet labeled: "*Parsing invalid HTML (e.g. unquoted attributes) also works:*" is mistaken in assuming that unquoted attributes are invalid.
parser.feed('<p><a class=link href=#main>tag soup</p ></a>') ...
According to the HTML4<http://www.w3.org/TR/REC-html40/intro/sgmltut.html#h-3.2.2>and HTML5 <http://dev.w3.org/html5/markup/syntax.html#syntax-attr-unquoted>attribute syntax spec, the example you provide are actually perfectly valid attribute definitions. You could add a space or other breaking/invalid character to the attribute value to correct it. Thanks! -Eric Higgins
4193
Age (days ago)
4193
Last active (days ago)
0 comments
1 participants
participants (1)
-
Eric Higgins