class docs for more info. class HTMLTagError(Exception): def __init__(self, msg, **values): class HTMLTagAttrLookupError(HTMLTagError, LookupError): pass class HTMLTagUnbalancedError(HTMLTagError): pass class HTMLNotAllowedError(HTMLTagError): pass class HTMLTagProcessingInstructionError(HTMLTagError): pass class HTMLTagIncompleteError(HTMLTagError): pass class HTMLTag: ## Init and reading ## def __init__(self, name): def readAttr(self, name, value): def addChild(self, child): ## Access ## def name(self): def attr(self, name, default=NoDefault): def hasAttr(self, name): def attrs(self): def numAttrs(self): def childAt(self, index): def numChildren(self): def children(self): def subtagAt(self, index): def numSubtags(self): def subtags(self): ## Printing ## def pprint(self, out=None, indent=0): def __repr__(self): ## Searching ## def tagWithMatchingAttr(self, name, value, default=NoDefault): def tagWithId(self, id, default=NoDefault): ## Self utility ## class HTMLReader(SGMLParser): ## Init ## def __init__(self, emptyTags=None, extraEmptyTags=None, fakeRootTagIfNeeded=1): ## Reading ## def readFileNamed(self, filename, retainRootTag=1): def readString(self, string, retainRootTag=1): ## Printing ## def pprint(self, out=None): ## Access ## def rootTag(self): def filename(self): def emptyTags(self): def setEmptyTags(self, tagList): def extendEmptyTags(self, tagList): ## Debugging ## def printsStack(self): def setPrintsStack(self, flag): ## Command line ## def main(self, args=None): def usage(self): ## SGMLParser handlers ## def handle_data(self, data): def handle_pi(self, data): def unknown_starttag(self, name, attrs): def unknown_endtag(self, name): def close(self): ## Self utility ## def computeTagContainmentConfig(self): ## Optimizations ## class TagConfig: def __init__(self, name, tags): def encounteredTag(self, tag, lineNum): class TagCanOnlyHaveConfig(TagConfig): def encounteredTag(self, tag, lineNum): class TagCannotHaveConfig(TagConfig): def encounteredTag(self, tag, lineNum):