Bs4Element class

Constructors

Bs4Element(Element element)
factory

Properties

a Bs4Element?
Returns the first occurrence of this tag down the parse tree.
no setterinherited
attributes LinkedHashMap<Object, String>
LinkedHashMap getter/setter of the element's attributes.
getter/setter pair
b Bs4Element?
Returns the first occurrence of this tag down the parse tree.
no setterinherited
body Bs4Element?
Returns the first occurrence of this tag down the parse tree.
no setterinherited
children List<Bs4Element>
The element's (tag's) children.
no setter
classes → CssClassSet
The set of CSS classes applied to this element.
no setter
className String
Getter/setter for the value of the class attribute.
getter/setter pair
contents List<Bs4Element>
The element's (tag's) children.
no setter
decomposed bool
no setter
descendants List<Bs4Element>
The element's (tag's) descendants.
no setter
dl Bs4Element?
Returns the first occurrence of this tag down the parse tree.
no setterinherited
doc ↔ dynamic
Returns Document or DocumentFragment, based on what parser was used with the BeautifulSoup constructor.
getter/setter pairinherited
element ↔ Element?
getter/setter pairinherited
h1 Bs4Element?
Returns the first occurrence of this tag down the parse tree.
no setterinherited
h2 Bs4Element?
Returns the first occurrence of this tag down the parse tree.
no setterinherited
h3 Bs4Element?
Returns the first occurrence of this tag down the parse tree.
no setterinherited
h4 Bs4Element?
Returns the first occurrence of this tag down the parse tree.
no setterinherited
h5 Bs4Element?
Returns the first occurrence of this tag down the parse tree.
no setterinherited
h6 Bs4Element?
Returns the first occurrence of this tag down the parse tree.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
Returns the first occurrence of this tag down the parse tree.
no setterinherited
html Bs4Element?
Returns the first occurrence of this tag down the parse tree.
no setterinherited
i Bs4Element?
Returns the first occurrence of this tag down the parse tree.
no setterinherited
id String
Getter/setter for the value of the id attribute.
getter/setter pair
img Bs4Element?
Returns the first occurrence of this tag down the parse tree.
no setterinherited
innerHtml String
Returns a fragment of HTML or XML that represents the element's contents.
getter/setter pair
name String?
Getter/setter of the tag name of the element.
getter/setter pair
nextElement Bs4Element?
The nextElement is an element that was parsed immediately afterwards (firstly searches next elements of children, if empty then nextSiblings).
no setter
nextElements List<Bs4Element>
The nextElement is an element that was parsed immediately afterwards (firstly searches next elements of children, if empty then nextSiblings).
no setter
nextParsed → Node?
Similar to nextElement but it returns a Node of what was parsed immediately after the current element. It might be doc comment, element, part of string, etc...
no setter
nextParsedAll List<Node>
Similar to nextElement but it returns a Node of what was parsed immediately after the current element. It might be doc comment, element, part of string, etc...
no setter
nextSibling Bs4Element?
Gets next element on the same level of the parse tree.
no setter
nextSiblings List<Bs4Element>
Gets all next elements on the same level of the parse tree.
no setter
nodes → NodeList
Returns the list of Nodes.
no setter
ol Bs4Element?
Returns the first occurrence of this tag down the parse tree.
no setterinherited
outerHtml String
Returns a fragment of HTML or XML that represents the element and its contents.
no setter
p Bs4Element?
Returns the first occurrence of this tag down the parse tree.
no setterinherited
parent Bs4Element?
The element's parent.
no setter
parents List<Bs4Element>
The element's all parents.
no setter
previousElement Bs4Element?
The previousElement is an element that was parsed immediately before the current element (firstly searches previousSiblings, if empty then parent).
no setter
previousElements List<Bs4Element>
The previousElement is an element that was parsed immediately before the current element (firstly searches previousSiblings, if empty then parent).
no setter
previousParsed → Node?
Similar to previousElement but it returns a Node of what was parsed immediately before the current element. It might be doc comment, element, part of string, etc...
no setter
previousParsedAll List<Node>
Similar to previousElement but it returns a Node of what was parsed immediately before the current element. It might be doc comment, element, part of string, etc...
no setter
previousSibling Bs4Element?
Gets previous element on the same level of the parse tree.
no setter
previousSiblings List<Bs4Element>
Gets all previous elements on the same level of the parse tree.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
string String
Returns or modifies the text of element(s).
getter/setter pair
strippedStrings String
Returns the text of an element(s), trims extra whitespaces from the left and removes empty lines.
no setter
table Bs4Element?
Returns the first occurrence of this tag down the parse tree.
no setterinherited
text String
Returns the text of an element.
no setterinherited
title Bs4Element?
Returns the first occurrence of this tag down the parse tree.
no setterinherited
ul Bs4Element?
Returns the first occurrence of this tag down the parse tree.
no setterinherited

Methods

append(Bs4Element element) → void
Adds an element just before the closing tags of the current element.
clear() → void
Removes the contents of a tag.
clone(bool deep) Bs4Element
Returns a copy of this node.
decompose() → void
Removes a tag from the tree, then completely destroys it and its contents.
extend(List<Bs4Element> element) → void
Adds elements just before the closing tags of the current element, in order.
extract() Bs4Element
Removes an element from the tree.
find(String name, {String? id, String? class_, Map<String, Object>? attrs, Pattern? regex, Pattern? string, String? selector}) Bs4Element?
Looks through a tag’s descendants and retrieves descendant that matches your filters.
inherited
findAll(String name, {String? id, String? class_, Map<String, Object>? attrs, Pattern? regex, Pattern? string, String? selector, int? limit}) List<Bs4Element>
Looks through a tag’s descendants and retrieves all descendants that match your filters.
inherited
findAllNextElements(String name, {String? id, String? class_, Map<String, Object>? attrs, Pattern? regex, Pattern? string, String? selector, int? limit}) List<Bs4Element>
These methods use nextElements to iterate over elements that come after it in the document.
inherited
findAllPreviousElements(String name, {String? id, String? class_, Map<String, Object>? attrs, Pattern? regex, Pattern? string, String? selector, int? limit}) List<Bs4Element>
These methods use previousElements to iterate over the tags and strings that came before it in the document.
inherited
findFirstAny() Bs4Element?
Returns the top most (first) element of the parse tree, of any tag type.
inherited
findNextElement(String name, {String? id, String? class_, Map<String, Object>? attrs, Pattern? regex, Pattern? string, String? selector}) Bs4Element?
These methods use nextElements to iterate over elements that come after it in the document.
inherited
findNextParsed({RegExp? pattern, int? nodeType}) → Node?
These methods use nextParsed to iterate over the tags, comments, strings, etc. that came after it in the document.
inherited
findNextParsedAll({RegExp? pattern, int? nodeType, int? limit}) List<Node>
These methods use nextParsed to iterate over the tags, comments, strings, etc. that came after it in the document.
inherited
findNextSibling(String name, {String? id, String? class_, Map<String, Object>? attrs, Pattern? regex, Pattern? string, String? selector}) Bs4Element?
These methods use nextSiblings to iterate over the rest of an element’s siblings in the tree.
inherited
findNextSiblings(String name, {String? id, String? class_, Map<String, Object>? attrs, Pattern? regex, Pattern? string, String? selector, int? limit}) List<Bs4Element>
These methods use nextSiblings to iterate over the rest of an element’s siblings in the tree.
inherited
findParent(String name, {String? id, String? class_, Map<String, Object>? attrs, Pattern? regex, Pattern? string, String? selector}) Bs4Element?
findAll and find work their way down the tree, looking at tag’s descendants.
inherited
findParents(String name, {String? id, String? class_, Map<String, Object>? attrs, Pattern? regex, Pattern? string, String? selector, int? limit}) List<Bs4Element>
findAll and find work their way down the tree, looking at tag’s descendants.
inherited
findPreviousElement(String name, {String? id, String? class_, Map<String, Object>? attrs, Pattern? regex, Pattern? string, String? selector}) Bs4Element?
These methods use previousElements to iterate over the tags and strings that came before it in the document.
inherited
findPreviousParsed({RegExp? pattern, int? nodeType}) → Node?
These methods use previousParsed to iterate over the tags, comments, strings, etc. that came before it in the document.
inherited
findPreviousParsedAll({RegExp? pattern, int? nodeType, int? limit}) List<Node>
These methods use previousParsed to iterate over the tags, comments, strings, etc. that came before it in the document.
inherited
findPreviousSibling(String name, {String? id, String? class_, Map<String, Object>? attrs, Pattern? regex, Pattern? string, String? selector}) Bs4Element?
These methods use previousSiblings to iterate over an element’s siblings that precede it in the tree.
inherited
findPreviousSiblings(String name, {String? id, String? class_, Map<String, Object>? attrs, Pattern? regex, Pattern? string, String? selector, int? limit}) List<Bs4Element>
These methods use previousSiblings to iterate over an element’s siblings that precede it in the tree.
inherited
getAttrValue(String name) String?
Gets an attribute value by name.
getText({String separator = '', bool strip = false}) String
Returns the text of an element.
inherited
hasAttr(String name) bool
Returns true if the element has defined this attribute.
insert(int position, Bs4Element element) → void
It is just like append, except the new element does not necessarily go at the end of its parent’s .contents. It’ll be inserted at whatever numeric position you say, just after the opening tag of the current element.
insertAfter(Bs4Element element, [Bs4Element? ref]) → void
Inserts an element immediately following the element in the parse tree.
insertBefore(Bs4Element element, [Bs4Element? ref]) → void
Inserts an element immediately before the current element in the parse tree.
newTag(String? name, {Map<String, String>? attrs, String? string}) Bs4Element
Creates a new Bs4Element.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
prettify() String
The method will turn a BeautifulSoup parse tree into a nicely formatted String, with a separate line for each tag and each string.
inherited
removeAttr(String name) → void
Removes the attribute with the specified name from the element.
reparentChildren(Node newParent) → void
Move all the children of the current node to newParent. This is needed so that trees that don't store text as nodes move the text in the correct way.
replaceWith(Bs4Element otherElement) Bs4Element
Removes an element from the tree, and replaces it with otherElement.
setAttr(String name, String value) → void
Sets the value of an attribute on the specified element.
toString() String
A string representation of this object.
override
unwrap() Bs4Element?
unwrap is the opposite of wrap.
wrap(Bs4Element newParentElement) Bs4Element
Wraps an element in the tag you specify. It returns the new wrapper.

Operators

operator ==(Object other) bool
The equality operator.
inherited
operator [](String name) String?
Gets an attribute value by name.
operator []=(String name, String value) → void
Sets the value of an attribute on the specified element.