|
|
| __init__ (self, BeautifulSoup soup, *Any args, Union[str, _DuplicateAttributeHandler] on_duplicate_attribute=REPLACE, **Any kwargs) |
| |
|
None | error (self, str message) |
| |
| None | handle_startendtag (self, str tag, List[Tuple[str, Optional[str]]] attrs) |
| |
| None | handle_starttag (self, str tag, List[Tuple[str, Optional[str]]] attrs, bool handle_empty_element=True) |
| |
| None | handle_endtag (self, str tag, bool check_already_closed=True) |
| |
| None | handle_data (self, str data) |
| |
| None | handle_charref (self, str name) |
| |
| None | handle_entityref (self, str name) |
| |
| None | handle_comment (self, str data) |
| |
| None | handle_decl (self, str decl) |
| |
| None | unknown_decl (self, str data) |
| |
| None | handle_pi (self, str data) |
| |
| bool | warn_if_markup_looks_like_xml (cls, Optional[_RawMarkup] markup, int stacklevel=3) |
| |
|
|
| soup |
| |
|
| on_duplicate_attribute |
| |
|
| attribute_dict_class |
| |
|
| already_closed_empty_element |
| |
|
| REPLACE |
| |
|
|
str | REPLACE = "replace" |
| |
|
str | IGNORE = "ignore" |
| |
|
Union | on_duplicate_attribute [str, _DuplicateAttributeHandler] |
| |
|
List | already_closed_empty_element [str] |
| |
|
BeautifulSoup | soup |
| |
|
Pattern | LOOKS_LIKE_HTML = re.compile("<[^ +]html", re.I) |
| |
|
Pattern | LOOKS_LIKE_HTML_B = re.compile(b"<[^ +]html", re.I) |
| |
|
str | XML_PREFIX = "<?xml" |
| |
|
bytes | XML_PREFIX_B = b"<?xml" |
| |
◆ handle_charref()
| None bs4.builder._htmlparser.BeautifulSoupHTMLParser.handle_charref |
( |
|
self, |
|
|
str |
name |
|
) |
| |
Handle a numeric character reference by converting it to the
corresponding Unicode character and treating it as textual
data.
:param name: Character number, possibly in hexadecimal.
◆ handle_comment()
| None bs4.builder._htmlparser.BeautifulSoupHTMLParser.handle_comment |
( |
|
self, |
|
|
str |
data |
|
) |
| |
Handle an HTML comment.
:param data: The text of the comment.
◆ handle_data()
| None bs4.builder._htmlparser.BeautifulSoupHTMLParser.handle_data |
( |
|
self, |
|
|
str |
data |
|
) |
| |
Handle some textual data that shows up between tags.
◆ handle_decl()
| None bs4.builder._htmlparser.BeautifulSoupHTMLParser.handle_decl |
( |
|
self, |
|
|
str |
decl |
|
) |
| |
Handle a DOCTYPE declaration.
:param data: The text of the declaration.
◆ handle_endtag()
| None bs4.builder._htmlparser.BeautifulSoupHTMLParser.handle_endtag |
( |
|
self, |
|
|
str |
tag, |
|
|
bool |
check_already_closed = True |
|
) |
| |
Handle a closing tag, e.g. '</tag>'
:param tag: A tag name.
:param check_already_closed: True if this tag is expected to
be the closing portion of an empty-element tag,
e.g. '<tag></tag>'.
◆ handle_entityref()
| None bs4.builder._htmlparser.BeautifulSoupHTMLParser.handle_entityref |
( |
|
self, |
|
|
str |
name |
|
) |
| |
Handle a named entity reference by converting it to the
corresponding Unicode character(s) and treating it as textual
data.
:param name: Name of the entity reference.
◆ handle_pi()
| None bs4.builder._htmlparser.BeautifulSoupHTMLParser.handle_pi |
( |
|
self, |
|
|
str |
data |
|
) |
| |
Handle a processing instruction.
:param data: The text of the instruction.
◆ handle_startendtag()
| None bs4.builder._htmlparser.BeautifulSoupHTMLParser.handle_startendtag |
( |
|
self, |
|
|
str |
tag, |
|
|
List[Tuple[str, Optional[str]]]
|
attrs |
|
) |
| |
Handle an incoming empty-element tag.
html.parser only calls this method when the markup looks like
<tag/>.
◆ handle_starttag()
| None bs4.builder._htmlparser.BeautifulSoupHTMLParser.handle_starttag |
( |
|
self, |
|
|
str |
tag, |
|
|
List[Tuple[str, Optional[str]]] |
attrs, |
|
|
bool |
handle_empty_element = True |
|
) |
| |
Handle an opening tag, e.g. '<tag>'
:param handle_empty_element: True if this tag is known to be
an empty-element tag (i.e. there is not expected to be any
closing tag).
◆ unknown_decl()
| None bs4.builder._htmlparser.BeautifulSoupHTMLParser.unknown_decl |
( |
|
self, |
|
|
str |
data |
|
) |
| |
Handle a declaration of unknown type -- probably a CDATA block.
:param data: The text of the declaration.
The documentation for this class was generated from the following file:
- docs/help/help-venv/lib/python3.12/site-packages/bs4/builder/_htmlparser.py