Uses of Class
org.jsoup.nodes.Element
Packages that use Element
Package
Description
Package containing classes supporting the core jsoup code.
HTML document structure nodes.
Contains the HTML parser, tag specifications, and HTML tokeniser.
Contains the jsoup HTML cleaner, and safelist definitions.
Packages to support the CSS-style element selector.
-
Uses of Element in org.jsoup.helper
Methods in org.jsoup.helper with parameters of type Element -
Uses of Element in org.jsoup.nodes
Subclasses of Element in org.jsoup.nodesModifier and TypeClassDescriptionclass
A HTML Document.class
An HTML Form Element provides ready access to the form fields/controls that are associated with it.class
Methods in org.jsoup.nodes that return ElementModifier and TypeMethodDescriptionElement.addClass
(String className) Add a class name to this element'sclass
attribute.Element.after
(String html) Insert the specified HTML into the DOM after this element (as a following sibling).Insert the specified node into the DOM after this node (as a following sibling).Element.append
(String html) Add inner HTML to this element.Element.appendChild
(Node child) Insert a node to the end of this Element's children.Element.appendChildren
(Collection<? extends Node> children) Insert the given nodes to the end of this Element's children.Element.appendElement
(String tagName) Create a new element by tag name, and add it as this Element's last child.Element.appendElement
(String tagName, String namespace) Create a new element by tag name and namespace, add it as this Element's last child.Element.appendText
(String text) Create and append a new TextNode to this element.Add this element to the supplied parent element, as its next child.Element.attr
(String attributeKey, boolean attributeValue) Set a boolean attribute value on this element.Element.attr
(String attributeKey, String attributeValue) Set an attribute value on this element.Element.before
(String html) Insert the specified HTML into the DOM before this element (as a preceding sibling).Insert the specified node into the DOM before this node (as a preceding sibling).Document.body()
Get this document's<body>
or<frameset>
element.Element.child
(int index) Get a child element of this element, by its 0-based index number.Element.classNames
(Set<String> classNames) Set the element'sclass
attribute to the supplied class names.Element.clearAttributes()
Element.clone()
@Nullable Element
Element.closest
(String cssQuery) Find the closest element up the tree of parents that matches the specified CSS query.@Nullable Element
Find the closest element up the tree of parents that matches the specified evaluator.Document.createElement
(String tagName) Create a new Element, with this document's base uri.protected Element
Element.empty()
Remove all the element's child nodes.Element.expectFirst
(String cssQuery) Just likeselectFirst(String)
, but if there is no match, throws anIllegalArgumentException
.Element.filter
(NodeFilter nodeFilter) @Nullable Element
Element.firstElementChild()
Gets the first child of this Element that is an Element, ornull
if there is none.Element.firstElementSibling()
Gets the first Element sibling of this element.Element.forEachNode
(Consumer<? super Node> action) @Nullable Element
Element.getElementById
(String id) Find an element by ID, including or under this element.Document.head()
Get this document'shead
element.Element.html
(String html) Set this element's inner HTML.Element.id
(String id) Set theid
attribute of this element.Element.insertChildren
(int index, Collection<? extends Node> children) Inserts the given child nodes into this element at the specified index.Element.insertChildren
(int index, Node... children) Inserts the given child nodes into this element at the specified index.@Nullable Element
Element.lastElementChild()
Gets the last child of this Element that is an Element, or @{code null} if there is none.Element.lastElementSibling()
Gets the last element sibling of this element.@Nullable Element
Element.nextElementSibling()
Gets the next sibling element of this element.final @Nullable Element
Element.parent()
Element.prepend
(String html) Add inner HTML into this element.Element.prependChild
(Node child) Add a node to the start of this element's children.Element.prependChildren
(Collection<? extends Node> children) Insert the given nodes to the start of this Element's children.Element.prependElement
(String tagName) Create a new element by tag name, and add it as this Element's first child.Element.prependElement
(String tagName, String namespace) Create a new element by tag name and namespace, and add it as this Element's first child.Element.prependText
(String text) Create and prepend a new TextNode to this element.@Nullable Element
Element.previousElementSibling()
Gets the previous element sibling of this element.Element.removeAttr
(String attributeKey) Element.removeClass
(String className) Remove a class name from this element'sclass
attribute.Element.root()
@Nullable Element
Element.selectFirst
(String cssQuery) Find the first Element that matches theSelector
CSS query, with this element as the starting context.@Nullable Element
Element.selectFirst
(Evaluator evaluator) Finds the first Element that matches the supplied Evaluator, with this element as the starting context, ornull
if none match.Element.shallowClone()
Element.tagName
(String tagName) Change (rename) the tag of this element.Element.tagName
(String tagName, String namespace) Change (rename) the tag of this element.Document.text
(String text) Set the text of thebody
of this document.Element.text
(String text) Set the text of this element.Element.toggleClass
(String className) Toggle a class name on this element'sclass
attribute: if present, remove it; otherwise add it.Element.traverse
(NodeVisitor nodeVisitor) Element.val
(String value) Set the value of a form element (input, textarea, etc).Element.wrap
(String html) Wrap the supplied HTML around this element.Methods in org.jsoup.nodes that return types with arguments of type ElementModifier and TypeMethodDescriptionIterator
<Element> Element.iterator()
Returns an Iterator that iterates this Element and each of its descendant Elements, in document order.Stream
<Element> Element.selectStream
(String cssQuery) Selects elements from the given root that match the specifiedSelector
CSS query, with this element as the starting context, and returns them as a lazy Stream.Stream
<Element> Element.selectStream
(Evaluator evaluator) Find a Stream of elements that match the supplied Evaluator.Stream
<Element> Element.stream()
Returns a Stream of this Element and all of its descendant Elements.Methods in org.jsoup.nodes with parameters of type ElementModifier and TypeMethodDescriptionFormElement.addElement
(Element element) Add a form control element to this form.Add this element to the supplied parent element, as its next child.Method parameters in org.jsoup.nodes with type arguments of type Element -
Uses of Element in org.jsoup.parser
Methods in org.jsoup.parser that return ElementModifier and TypeMethodDescriptionStreamParser.expectFirst
(String query) Just likeStreamParser.selectFirst(String)
, but if there is no match, throws anIllegalArgumentException
.StreamParser.expectNext
(String query) Just likeStreamParser.selectFirst(String)
, but if there is no match, throws anIllegalArgumentException
.@Nullable Element
StreamParser.selectFirst
(String query) Finds the first Element that matches the provided query.@Nullable Element
StreamParser.selectFirst
(Evaluator eval) Finds the first Element that matches the provided query.@Nullable Element
StreamParser.selectNext
(String query) Finds the next Element that matches the provided query.@Nullable Element
StreamParser.selectNext
(Evaluator eval) Finds the next Element that matches the provided query.Methods in org.jsoup.parser that return types with arguments of type ElementModifier and TypeMethodDescriptionIterator
<Element> StreamParser.iterator()
Returns anIterator
ofElement
s, with the input being parsed as each element is consumed.Stream
<Element> StreamParser.stream()
Creates aStream
ofElement
s, with the input being parsed as each element is consumed.Methods in org.jsoup.parser with parameters of type ElementModifier and TypeMethodDescriptionstatic List
<Node> Parser.parseFragment
(String fragmentHtml, Element context, String baseUri) Parse a fragment of HTML into a list of nodes.static List
<Node> Parser.parseFragment
(String fragmentHtml, Element context, String baseUri, ParseErrorList errorList) Parse a fragment of HTML into a list of nodes.StreamParser.parseFragment
(Reader input, @Nullable Element context, String baseUri) Provide the input for a fragment parse.StreamParser.parseFragment
(String input, @Nullable Element context, String baseUri) Provide the input for a fragment parse.List
<Node> Parser.parseFragmentInput
(Reader fragment, @Nullable Element context, String baseUri) List
<Node> Parser.parseFragmentInput
(String fragment, @Nullable Element context, String baseUri) -
Uses of Element in org.jsoup.safety
Methods in org.jsoup.safety with parameters of type ElementModifier and TypeMethodDescriptionboolean
Safelist.isSafeAttribute
(String tagName, Element el, Attribute attr) Test if the supplied attribute is allowed by this safelist for this tag. -
Uses of Element in org.jsoup.select
Methods in org.jsoup.select that return ElementModifier and TypeMethodDescriptionElements.expectFirst
(String cssQuery) Just likeElements.selectFirst(String)
, but if there is no match, throws anIllegalArgumentException
.static @Nullable Element
Finds the first Element that matches the Evaluator that descends from the root, and stops the query once that first match is found.@Nullable Element
Elements.first()
Get the first matched element.@Nullable Element
Elements.last()
Get the last matched element.Elements.remove
(int index) Remove the Element at the specified index in this ist, and from the DOM.@Nullable Element
Elements.selectFirst
(String cssQuery) Find the first Element that matches theSelector
CSS query within this element list.static @Nullable Element
Selector.selectFirst
(String cssQuery, Iterable<Element> roots) Find the first element matching the query, across multiple roots.static @Nullable Element
Selector.selectFirst
(String cssQuery, Element root) Find the first Element that matches the query.Replace the Element at the specified index in this list, and in the DOM.Methods in org.jsoup.select that return types with arguments of type ElementModifier and TypeMethodDescriptionPredicate
<Element> Evaluator.asPredicate
(Element root) Provides a Predicate for this Evaluator, matching the test Element.static Stream
<Element> Selector.selectStream
(String query, Element root) Finds a Stream of elements matching the CSS query.static Stream
<Element> Selector.selectStream
(Evaluator evaluator, Element root) Finds a Stream of elements matching the evaluator.static Stream
<Element> Obtain a Stream of elements by visiting the root and every descendant of root and testing it against the evaluator.Methods in org.jsoup.select with parameters of type ElementModifier and TypeMethodDescriptionPredicate
<Element> Evaluator.asPredicate
(Element root) Provides a Predicate for this Evaluator, matching the test Element.protected abstract int
Evaluator.CssNthEvaluator.calculatePosition
(Element root, Element element) protected int
Evaluator.IsNthChild.calculatePosition
(Element root, Element element) protected int
Evaluator.IsNthLastChild.calculatePosition
(Element root, Element element) protected int
Evaluator.IsNthLastOfType.calculatePosition
(Element root, Element element) protected int
Evaluator.IsNthOfType.calculatePosition
(Element root, Element element) static Elements
Build a list of elements, by visiting the root and every descendant of root, and testing it against the Evaluator.static @Nullable Element
Finds the first Element that matches the Evaluator that descends from the root, and stops the query once that first match is found.boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
abstract boolean
Test if the element meets the evaluator's requirements.boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
static Elements
Find Elements matching the CSS query.static Elements
Find Elements matching the Evaluator.static @Nullable Element
Selector.selectFirst
(String cssQuery, Element root) Find the first Element that matches the query.static Stream
<Element> Selector.selectStream
(String query, Element root) Finds a Stream of elements matching the CSS query.static Stream
<Element> Selector.selectStream
(Evaluator evaluator, Element root) Finds a Stream of elements matching the evaluator.Replace the Element at the specified index in this list, and in the DOM.static Stream
<Element> Obtain a Stream of elements by visiting the root and every descendant of root and testing it against the evaluator.Method parameters in org.jsoup.select with type arguments of type ElementModifier and TypeMethodDescriptionboolean
Remove from the list, and from the DOM, all elements in this list that mach the given filter.void
Elements.replaceAll
(UnaryOperator<Element> operator) Replace each element in this list with the result of the operator, and update the DOM.static Elements
Find elements matching the query, across multiple roots.static @Nullable Element
Selector.selectFirst
(String cssQuery, Iterable<Element> roots) Find the first element matching the query, across multiple roots.Constructors in org.jsoup.select with parameters of type ElementConstructor parameters in org.jsoup.select with type arguments of type Element