New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTMLParser attribute parsing bug #37954
Comments
HTMLParser (reportedly) fails to parse this construct: <a href="http://ss"title="pe"\>P\</a> (Note that a required space between the two attributes Assigned to me. |
Logged In: YES HTMLParser (and lots of other parsers I tried) has Cheers, Bastian |
Logged In: YES Two troublesome input examples: Here's a fix I came up with in HTMLParser.py: replace the locatestarttagend = re.compile(r"""
<[a-zA-Z][-.a-zA-Z0-9:_]* # tag name
\s* # whitespace after tag name
(?:
(?:[a-zA-Z_][-.:a-zA-Z0-9_]* # attribute name
(?:\s*=\s* # value indicator
(?:'[^']*' # LITA-enclosed value
|\"[^\"]*\" # LIT-enclosed value
|[^'\">\s]+ # bare value
)?
)?
)
\s* # whitespace between attrs
)*
\s* # trailing whitespace
""", re.VERBOSE) |
Logged In: YES I'm using python 2.3.3. I note that bug 699079, which addresses this same issue, was closed If it's going to stop parsing when the error occurs, then I'd much |
Logged In: YES In response to rdmurray's comment: in Python 2.4, at least, an exception Not sure why this bug is being kept open... but see bug 736428 and |
Closed as fixed in r23322. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: