| 4 | from HTMLParser import HTMLParser |
| 5 | |
| 6 | class SimpleParser(HTMLParser): |
| 7 | def __init__(self): |
| 8 | HTMLParser.__init__(self) |
| 9 | self.elements = [] |
| 10 | |
| 11 | def handle_starttag(self, tag, attrs): |
| 12 | self.elements.append((tag, dict(attrs))) |
| 13 | |
| 14 | def assertValidHTML(text): |
| 15 | h = SimpleParser() |
no outgoing calls