Public Member Functions | |
def | __getattr__ |
def | __init__ |
def | convert_charref |
def | endData |
def | handle_charref |
def | handle_comment |
def | handle_data |
def | handle_decl |
def | handle_entityref |
def | handle_pi |
def | isSelfClosingTag |
def | parse_declaration |
def | popTag |
def | pushTag |
def | reset |
def | unknown_endtag |
def | unknown_starttag |
Public Member Functions inherited from BeautifulSoup.Tag | |
def | __call__ |
def | __contains__ |
def | __delitem__ |
def | __eq__ |
def | __getattr__ |
def | __getitem__ |
def | __init__ |
def | __iter__ |
def | __len__ |
def | __ne__ |
def | __nonzero__ |
def | __repr__ |
def | __setitem__ |
def | __str__ |
def | __unicode__ |
def | childGenerator |
def | clear |
def | decompose |
def | fetchText |
def | find |
def | findAll |
def | firstText |
def | get |
def | getString |
def | getText |
def | has_key |
def | index |
def | prettify |
def | recursiveChildGenerator |
def | renderContents |
def | setString |
Static Public Attributes | |
ALL_ENTITIES = XHTML_ENTITIES | |
string | HTML_ENTITIES = "html" |
list | MARKUP_MASSAGE |
dictionary | NESTABLE_TAGS = {} |
list | PRESERVE_WHITESPACE_TAGS = [] |
dictionary | QUOTE_TAGS = {} |
dictionary | RESET_NESTING_TAGS = {} |
string | ROOT_TAG_NAME = u'[document]' |
dictionary | SELF_CLOSING_TAGS = {} |
dictionary | STRIP_ASCII_SPACES = { 9: None, 10: None, 12: None, 13: None, 32: None, } |
string | XHTML_ENTITIES = "xhtml" |
string | XML_ENTITIES = "xml" |
Static Public Attributes inherited from BeautifulSoup.Tag | |
fetch = findAll | |
findChild = find | |
findChildren = findAll | |
first = find | |
Private Member Functions | |
def | _feed |
def | _popToTag |
def | _smartPop |
def | _toStringSubclass |
Additional Inherited Members | |
Properties inherited from BeautifulSoup.Tag | |
string = property(getString, setString) | |
text = property(getText) | |
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.
Definition at line 1039 of file BeautifulSoup.py.
def BeautifulSoup.BeautifulStoneSoup.__init__ | ( | self, | |
markup = "" , |
|||
parseOnlyThese = None , |
|||
fromEncoding = None , |
|||
markupMassage = True , |
|||
smartQuotesTo = XML_ENTITIES , |
|||
convertEntities = None , |
|||
selfClosingTags = None , |
|||
isHTML = False |
|||
) |
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.
Definition at line 1085 of file BeautifulSoup.py.
def BeautifulSoup.BeautifulStoneSoup.__getattr__ | ( | self, | |
methodName | |||
) |
This method routes method call requests to either the SGMLParser superclass or the Tag superclass, depending on the method name.
Definition at line 1195 of file BeautifulSoup.py.
Referenced by VarParsing.VarParsing.setType().
|
private |
Definition at line 1162 of file BeautifulSoup.py.
References BeautifulSoup.BeautifulStoneSoup.markup.
|
private |
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.
Definition at line 1262 of file BeautifulSoup.py.
References BeautifulSoup.BeautifulStoneSoup.popTag(), BeautifulSoup.BeautifulStoneSoup.ROOT_TAG_NAME, and BeautifulSoup.BeautifulStoneSoup.tagStack.
Referenced by BeautifulSoup.BeautifulStoneSoup._smartPop(), and BeautifulSoup.BeautifulStoneSoup.unknown_endtag().
|
private |
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'
Definition at line 1284 of file BeautifulSoup.py.
References BeautifulSoup.BeautifulStoneSoup._popToTag(), and BeautifulSoup.BeautifulStoneSoup.tagStack.
Referenced by BeautifulSoup.BeautifulStoneSoup.unknown_starttag().
|
private |
Adds a certain piece of text to the tree as a NavigableString subclass.
Definition at line 1376 of file BeautifulSoup.py.
References BeautifulSoup.BeautifulStoneSoup.endData(), and BeautifulSoup.BeautifulStoneSoup.handle_data().
Referenced by BeautifulSoup.BeautifulStoneSoup.handle_comment(), BeautifulSoup.BeautifulStoneSoup.handle_decl(), BeautifulSoup.BeautifulStoneSoup.handle_pi(), and BeautifulSoup.BeautifulStoneSoup.parse_declaration().
def BeautifulSoup.BeautifulStoneSoup.convert_charref | ( | self, | |
name | |||
) |
This method fixes a bug in Python's SGMLParser.
Definition at line 1152 of file BeautifulSoup.py.
def BeautifulSoup.BeautifulStoneSoup.endData | ( | self, | |
containerClass = NavigableString |
|||
) |
Definition at line 1239 of file BeautifulSoup.py.
References BeautifulSoup.BeautifulStoneSoup.currentData, BeautifulSoup.BeautifulStoneSoup.currentTag, reco::helper::VirtualJetProducerHelper.intersection(), join(), BeautifulSoup.BeautifulStoneSoup.parseOnlyThese, BeautifulSoup.BeautifulStoneSoup.PRESERVE_WHITESPACE_TAGS, BeautifulSoup.BeautifulStoneSoup.previous, BeautifulSoup.BeautifulStoneSoup.STRIP_ASCII_SPACES, and BeautifulSoup.BeautifulStoneSoup.tagStack.
Referenced by BeautifulSoup.BeautifulStoneSoup._toStringSubclass(), BeautifulSoup.BeautifulStoneSoup.unknown_endtag(), and BeautifulSoup.BeautifulStoneSoup.unknown_starttag().
def BeautifulSoup.BeautifulStoneSoup.handle_charref | ( | self, | |
ref | |||
) |
Definition at line 1395 of file BeautifulSoup.py.
References BeautifulSoup.BeautifulStoneSoup.convertEntities, and BeautifulSoup.BeautifulStoneSoup.handle_data().
def BeautifulSoup.BeautifulStoneSoup.handle_comment | ( | self, | |
text | |||
) |
Definition at line 1391 of file BeautifulSoup.py.
References BeautifulSoup.BeautifulStoneSoup._toStringSubclass().
def BeautifulSoup.BeautifulStoneSoup.handle_data | ( | self, | |
data | |||
) |
Definition at line 1373 of file BeautifulSoup.py.
Referenced by BeautifulSoup.BeautifulStoneSoup._toStringSubclass(), BeautifulSoup.BeautifulStoneSoup.handle_charref(), BeautifulSoup.BeautifulStoneSoup.handle_entityref(), BeautifulSoup.BeautifulStoneSoup.parse_declaration(), BeautifulSoup.BeautifulStoneSoup.unknown_endtag(), and BeautifulSoup.BeautifulStoneSoup.unknown_starttag().
def BeautifulSoup.BeautifulStoneSoup.handle_decl | ( | self, | |
data | |||
) |
Definition at line 1446 of file BeautifulSoup.py.
References BeautifulSoup.BeautifulStoneSoup._toStringSubclass().
def BeautifulSoup.BeautifulStoneSoup.handle_entityref | ( | self, | |
ref | |||
) |
Handle entity references as data, possibly converting known HTML and/or XML entity references to the corresponding Unicode characters.
Definition at line 1403 of file BeautifulSoup.py.
References BeautifulSoup.Tag.convertHTMLEntities, BeautifulSoup.Tag.convertXMLEntities, and BeautifulSoup.BeautifulStoneSoup.handle_data().
def BeautifulSoup.BeautifulStoneSoup.handle_pi | ( | self, | |
text | |||
) |
Handle a processing instruction as a ProcessingInstruction object, possibly one with a %SOUP-ENCODING% slot into which an encoding will be plugged later.
Definition at line 1383 of file BeautifulSoup.py.
References BeautifulSoup.BeautifulStoneSoup._toStringSubclass().
def BeautifulSoup.BeautifulStoneSoup.isSelfClosingTag | ( | self, | |
name | |||
) |
Returns true iff the given string is the name of a self-closing tag according to this parser.
Definition at line 1208 of file BeautifulSoup.py.
Referenced by BeautifulSoup.BeautifulStoneSoup.unknown_starttag().
def BeautifulSoup.BeautifulStoneSoup.parse_declaration | ( | self, | |
i | |||
) |
Treat a bogus SGML declaration as raw data. Treat a CDATA declaration as a CData object.
Definition at line 1450 of file BeautifulSoup.py.
References BeautifulSoup.BeautifulStoneSoup._toStringSubclass(), BeautifulSoup.BeautifulStoneSoup.handle_data(), and DQMNet::Object.rawdata.
def BeautifulSoup.BeautifulStoneSoup.popTag | ( | self | ) |
Definition at line 1224 of file BeautifulSoup.py.
References BeautifulSoup.BeautifulStoneSoup.currentTag, and BeautifulSoup.BeautifulStoneSoup.tagStack.
Referenced by BeautifulSoup.BeautifulStoneSoup._popToTag(), and BeautifulSoup.BeautifulStoneSoup.unknown_starttag().
def BeautifulSoup.BeautifulStoneSoup.pushTag | ( | self, | |
tag | |||
) |
Definition at line 1232 of file BeautifulSoup.py.
References BeautifulSoup.BeautifulStoneSoup.currentTag, and BeautifulSoup.BeautifulStoneSoup.tagStack.
Referenced by BeautifulSoup.BeautifulStoneSoup.unknown_starttag().
def BeautifulSoup.BeautifulStoneSoup.reset | ( | self | ) |
Definition at line 1214 of file BeautifulSoup.py.
References BeautifulSoup.BeautifulStoneSoup.ROOT_TAG_NAME.
def BeautifulSoup.BeautifulStoneSoup.unknown_endtag | ( | self, | |
name | |||
) |
def BeautifulSoup.BeautifulStoneSoup.unknown_starttag | ( | self, | |
name, | |||
attrs, | |||
selfClosing = 0 |
|||
) |
Definition at line 1330 of file BeautifulSoup.py.
References BeautifulSoup.BeautifulStoneSoup._smartPop(), BeautifulSoup.BeautifulStoneSoup.currentTag, BeautifulSoup.BeautifulStoneSoup.endData(), BeautifulSoup.BeautifulStoneSoup.handle_data(), BeautifulSoup.BeautifulStoneSoup.isSelfClosingTag(), join(), BeautifulSoup.BeautifulStoneSoup.parseOnlyThese, BeautifulSoup.BeautifulStoneSoup.popTag(), BeautifulSoup.BeautifulStoneSoup.previous, BeautifulSoup.BeautifulStoneSoup.pushTag(), BeautifulSoup.BeautifulStoneSoup.QUOTE_TAGS, BeautifulSoup.BeautifulStoneSoup.quoteStack, and BeautifulSoup.BeautifulStoneSoup.tagStack.
|
static |
Definition at line 1075 of file BeautifulSoup.py.
BeautifulSoup.BeautifulStoneSoup.convertEntities |
Definition at line 1114 of file BeautifulSoup.py.
Referenced by BeautifulSoup.BeautifulStoneSoup.handle_charref().
BeautifulSoup.BeautifulStoneSoup.convertHTMLEntities |
Definition at line 1124 of file BeautifulSoup.py.
BeautifulSoup.BeautifulStoneSoup.convertXMLEntities |
Definition at line 1123 of file BeautifulSoup.py.
BeautifulSoup.BeautifulStoneSoup.currentData |
Definition at line 1218 of file BeautifulSoup.py.
Referenced by BeautifulSoup.BeautifulStoneSoup.endData().
BeautifulSoup.BeautifulStoneSoup.currentTag |
Definition at line 1219 of file BeautifulSoup.py.
Referenced by BeautifulSoup.BeautifulStoneSoup.endData(), BeautifulSoup.BeautifulStoneSoup.popTag(), BeautifulSoup.BeautifulStoneSoup.pushTag(), and BeautifulSoup.BeautifulStoneSoup.unknown_starttag().
BeautifulSoup.BeautifulStoneSoup.declaredHTMLEncoding |
Definition at line 1174 of file BeautifulSoup.py.
Referenced by BeautifulSoup.UnicodeDammit._detectEncoding(), and BeautifulSoup.BeautifulSoup.start_meta().
BeautifulSoup.BeautifulStoneSoup.escapeUnrecognizedEntities |
Definition at line 1125 of file BeautifulSoup.py.
BeautifulSoup.BeautifulStoneSoup.fromEncoding |
Definition at line 1112 of file BeautifulSoup.py.
BeautifulSoup.BeautifulStoneSoup.hidden |
Definition at line 1216 of file BeautifulSoup.py.
|
static |
Definition at line 1071 of file BeautifulSoup.py.
Referenced by BeautifulSoup.BeautifulSoup.__init__().
BeautifulSoup.BeautifulStoneSoup.instanceSelfClosingTags |
Definition at line 1139 of file BeautifulSoup.py.
BeautifulSoup.BeautifulStoneSoup.literal |
Definition at line 1357 of file BeautifulSoup.py.
Referenced by BeautifulSoup.BeautifulStoneSoup.unknown_endtag().
BeautifulSoup.BeautifulStoneSoup.markup |
Definition at line 1144 of file BeautifulSoup.py.
Referenced by BeautifulSoup.UnicodeDammit._convertFrom(), and BeautifulSoup.BeautifulStoneSoup._feed().
|
static |
Definition at line 1063 of file BeautifulSoup.py.
BeautifulSoup.BeautifulStoneSoup.markupMassage |
Definition at line 1145 of file BeautifulSoup.py.
|
static |
Definition at line 1058 of file BeautifulSoup.py.
BeautifulSoup.BeautifulStoneSoup.originalEncoding |
Definition at line 1167 of file BeautifulSoup.py.
BeautifulSoup.BeautifulStoneSoup.parseOnlyThese |
Definition at line 1111 of file BeautifulSoup.py.
Referenced by BeautifulSoup.BeautifulStoneSoup.endData(), and BeautifulSoup.BeautifulStoneSoup.unknown_starttag().
|
static |
Definition at line 1061 of file BeautifulSoup.py.
Referenced by BeautifulSoup.BeautifulStoneSoup.endData().
BeautifulSoup.BeautifulStoneSoup.previous |
Definition at line 1258 of file BeautifulSoup.py.
Referenced by BeautifulSoup.PageElement._invert(), BeautifulSoup.BeautifulStoneSoup.endData(), and BeautifulSoup.BeautifulStoneSoup.unknown_starttag().
|
static |
Definition at line 1060 of file BeautifulSoup.py.
Referenced by BeautifulSoup.BeautifulStoneSoup.unknown_starttag().
BeautifulSoup.BeautifulStoneSoup.quoteStack |
Definition at line 1221 of file BeautifulSoup.py.
Referenced by BeautifulSoup.BeautifulStoneSoup.unknown_endtag(), and BeautifulSoup.BeautifulStoneSoup.unknown_starttag().
|
static |
Definition at line 1059 of file BeautifulSoup.py.
|
static |
Definition at line 1069 of file BeautifulSoup.py.
Referenced by BeautifulSoup.BeautifulStoneSoup._popToTag(), and BeautifulSoup.BeautifulStoneSoup.reset().
|
static |
Definition at line 1057 of file BeautifulSoup.py.
BeautifulSoup.BeautifulStoneSoup.smartQuotesTo |
Definition at line 1113 of file BeautifulSoup.py.
Referenced by BeautifulSoup.UnicodeDammit._convertFrom(), and BeautifulSoup.UnicodeDammit._subMSChar().
|
static |
Definition at line 1081 of file BeautifulSoup.py.
Referenced by BeautifulSoup.BeautifulStoneSoup.endData().
BeautifulSoup.BeautifulStoneSoup.tagStack |
Definition at line 1220 of file BeautifulSoup.py.
Referenced by BeautifulSoup.BeautifulStoneSoup._popToTag(), BeautifulSoup.BeautifulStoneSoup._smartPop(), BeautifulSoup.BeautifulStoneSoup.endData(), BeautifulSoup.BeautifulStoneSoup.popTag(), BeautifulSoup.BeautifulSOAP.popTag(), BeautifulSoup.BeautifulStoneSoup.pushTag(), and BeautifulSoup.BeautifulStoneSoup.unknown_starttag().
|
static |
Definition at line 1073 of file BeautifulSoup.py.
|
static |
Definition at line 1072 of file BeautifulSoup.py.