Home | Trees | Indices | Help |
---|
|
This class contains the basic parser and search code. It defines a parser that knows nothing about tag behavior except for the following: You can't close a tag without closing all the tags it encloses. That is, "<foo><bar></foo>" actually means "<foo><bar></bar></foo>". [Another possible explanation is "<foo><bar /></foo>", but since this class defines no SELF_CLOSING_TAGS, it will never use that explanation.] This class is useful for parsing XML or made-up markup languages, or when BeautifulSoup makes an assumption counter to what you were expecting.
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from Inherited from Inherited from Inherited from Inherited from Inherited from Inherited from Inherited from Inherited from |
|
|||
SELF_CLOSING_TAGS = {}
|
|||
NESTABLE_TAGS = {}
|
|||
RESET_NESTING_TAGS = {}
|
|||
QUOTE_TAGS = {}
|
|||
PRESERVE_WHITESPACE_TAGS = []
|
|||
MARKUP_MASSAGE = [(re.compile('(<[^<>]*)/>'), lambda x: x.grou
|
|||
ROOT_TAG_NAME = u'[document]'
|
|||
HTML_ENTITIES = "html"
|
|||
XML_ENTITIES = "xml"
|
|||
XHTML_ENTITIES = "xhtml"
|
|||
ALL_ENTITIES = "xhtml"
|
|||
STRIP_ASCII_SPACES = {9: None, 10: None, 12: None, 13: None, 3
|
|||
Inherited from Inherited from Inherited from |
|
|||
Inherited from |
|
The Soup object is initialized as the 'root tag', and the provided markup (which can be a string or a file-like object) is fed into the underlying parser. sgmllib will process most bad HTML, and the BeautifulSoup class has some tricks for dealing with some HTML that kills sgmllib, but Beautiful Soup can nonetheless choke or lose data if your data uses self-closing tags or declarations incorrectly. By default, Beautiful Soup uses regexes to sanitize input, avoiding the vast majority of these problems. If the problems don't apply to you, pass in False for markupMassage, and you'll get better performance. The default parser massage techniques fix the two most common instances of invalid HTML that choke sgmllib: <br/> (No space between name of closing tag and tag close) <! --Comment--> (Extraneous whitespace in declaration) You can pass in a custom list of (RE object, replace method) tuples to get Beautiful Soup to scrub your input the way you want.
|
This method fixes a bug in Python's SGMLParser.
|
This method routes method call requests to either the SGMLParser superclass or the Tag superclass, depending on the method name.
|
Reset this instance. Loses all unprocessed data.
|
Pops the tag stack up to and including the most recent instance of the given tag. If inclusivePop is false, pops the tag stack up to but *not* including the most recent instqance of the given tag. |
We need to pop up to the previous tag of this type, unless one of this tag's nesting reset triggers comes between this tag and the previous tag of this type, OR unless this tag is a generic nesting trigger and another generic nesting trigger comes between this tag and the previous tag of this type. Examples: <p>Foo<b>Bar *<p>* should pop to 'p', not 'b'. <p>Foo<table>Bar *<p>* should pop to 'table', not 'p'. <p>Foo<table><tr>Bar *<p>* should pop to 'tr', not 'p'. <li><ul><li> *<li>* should pop to 'ul', not the first 'li'. <tr><table><tr> *<tr>* should pop to 'table', not the first 'tr' <td><tr><td> *<td>* should pop to 'tr', not the first 'td' |
|
|
|
Handle a processing instruction as a ProcessingInstruction object, possibly one with a %SOUP-ENCODING% slot into which an encoding will be plugged later.
|
Handle comments as Comment objects.
|
Handle character references as data.
|
Handle entity references as data, possibly converting known HTML and/or XML entity references to the corresponding Unicode characters.
|
Handle DOCTYPEs and the like as Declaration objects.
|
Treat a bogus SGML declaration as raw data. Treat a CDATA declaration as a CData object.
|
|
MARKUP_MASSAGE
|
STRIP_ASCII_SPACES
|
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Thu Sep 16 13:42:09 2010 | http://epydoc.sourceforge.net |