Uses of Class
org.jsoup.nodes.Element
-
Packages that use Element Package Description org.jsoup.examples Contains example programs and use of jsoup.org.jsoup.helper Package containing classes supporting the core jsoup code.org.jsoup.nodes HTML document structure nodes.org.jsoup.parser Contains the HTML parser, tag specifications, and HTML tokeniser.org.jsoup.safety Contains the jsoup HTML cleaner, and safelist definitions.org.jsoup.select Packages to support the CSS-style element selector. -
-
Uses of Element in org.jsoup.examples
Methods in org.jsoup.examples with parameters of type Element Modifier and Type Method Description java.lang.String
HtmlToPlainText. getPlainText(Element element)
Format an Element to plain-text -
Uses of Element in org.jsoup.helper
Fields in org.jsoup.helper declared as Element Modifier and Type Field Description private Element
W3CDom.W3CBuilder. contextElement
Methods in org.jsoup.helper with parameters of type Element Modifier and Type Method Description void
W3CDom. convert(Element in, org.w3c.dom.Document out)
Converts a jsoup element into the provided W3C Document.org.w3c.dom.Document
W3CDom. fromJsoup(Element in)
Convert a jsoup DOM to a W3C Document.private java.lang.String
W3CDom.W3CBuilder. updateNamespaces(Element el)
Finds any namespaces defined in this element. -
Uses of Element in org.jsoup.nodes
Subclasses of Element in org.jsoup.nodes Modifier and Type Class Description class
Document
A HTML Document.class
FormElement
A HTML Form Element provides ready access to the form fields/controls that are associated with it.class
PseudoTextElement
Fields in org.jsoup.nodes declared as Element Modifier and Type Field Description private Element
Element.NodeList. owner
Fields in org.jsoup.nodes with type parameters of type Element Modifier and Type Field Description private static java.util.List<Element>
Element. EmptyChildren
private java.lang.ref.WeakReference<java.util.List<Element>>
Element. shadowChildrenRef
Methods in org.jsoup.nodes with type parameters of type Element Modifier and Type Method Description private static <E extends Element>
intElement. indexInList(Element search, java.util.List<E> elements)
Methods in org.jsoup.nodes that return Element Modifier and Type Method Description Element
Element. addClass(java.lang.String className)
Add a class name to this element'sclass
attribute.Element
Element. after(java.lang.String html)
Insert the specified HTML into the DOM after this element (as a following sibling).Element
Element. after(Node node)
Insert the specified node into the DOM after this node (as a following sibling).Element
Element. append(java.lang.String html)
Add inner HTML to this element.Element
Element. appendChild(Node child)
Insert a node to the end of this Element's children.Element
Element. appendChildren(java.util.Collection<? extends Node> children)
Insert the given nodes to the end of this Element's children.Element
Element. appendElement(java.lang.String tagName)
Create a new element by tag name, and add it as this Element's last child.Element
Element. appendElement(java.lang.String tagName, java.lang.String namespace)
Create a new element by tag name and namespace, add it as this Element's last child.Element
Element. appendText(java.lang.String text)
Create and append a new TextNode to this element.Element
Element. appendTo(Element parent)
Add this element to the supplied parent element, as its next child.Element
Element. attr(java.lang.String attributeKey, boolean attributeValue)
Set a boolean attribute value on this element.Element
Element. attr(java.lang.String attributeKey, java.lang.String attributeValue)
Set an attribute value on this element.Element
Element. before(java.lang.String html)
Insert the specified HTML into the DOM before this element (as a preceding sibling).Element
Element. before(Node node)
Insert the specified node into the DOM before this node (as a preceding sibling).Element
Document. body()
Get this document's<body>
or<frameset>
element.Element
Element. child(int index)
Get a child element of this element, by its 0-based index number.Element
Element. classNames(java.util.Set<java.lang.String> classNames)
Set the element'sclass
attribute to the supplied class names.Element
Element. clearAttributes()
Element
Element. clone()
Element
Element. closest(java.lang.String cssQuery)
Find the closest element up the tree of parents that matches the specified CSS query.Element
Element. closest(Evaluator evaluator)
Find the closest element up the tree of parents that matches the specified evaluator.Element
Document. createElement(java.lang.String tagName)
Create a new Element, with this document's base uri.protected Element
Element. doClone(Node parent)
Element
Element. empty()
Remove all the element's child nodes.Element
Element. expectFirst(java.lang.String cssQuery)
Just likeselectFirst(String)
, but if there is no match, throws anIllegalArgumentException
.Element
Element. filter(NodeFilter nodeFilter)
Element
Element. firstElementChild()
Gets the first child of this Element that is an Element, ornull
if there is none.Element
Element. firstElementSibling()
Gets the first Element sibling of this element.Element
Element. forEach(java.util.function.Consumer<? super Element> action)
Deprecated.usestream()
.forEach(Consumer)
instead.Element
Element. forEachNode(java.util.function.Consumer<? super Node> action)
private Element
Node. getDeepChild(Element el)
Element
Element. getElementById(java.lang.String id)
Find an element by ID, including or under this element.Element
Document. head()
Get this document'shead
element.Element
Element. html(java.lang.String html)
Set this element's inner HTML.private Element
Document. htmlEl()
Find the root HTML element, or create it if it doesn't exist.Element
Element. id(java.lang.String id)
Set theid
attribute of this element.Element
Element. insertChildren(int index, java.util.Collection<? extends Node> children)
Inserts the given child nodes into this element at the specified index.Element
Element. insertChildren(int index, Node... children)
Inserts the given child nodes into this element at the specified index.Element
Element. lastElementChild()
Gets the last child of this Element that is an Element, or @{code null} if there is none.Element
Element. lastElementSibling()
Gets the last element sibling of this element.Element
Element. nextElementSibling()
Gets the next sibling element of this element.Element
Element. parent()
Element
Element. prepend(java.lang.String html)
Add inner HTML into this element.Element
Element. prependChild(Node child)
Add a node to the start of this element's children.Element
Element. prependChildren(java.util.Collection<? extends Node> children)
Insert the given nodes to the start of this Element's children.Element
Element. prependElement(java.lang.String tagName)
Create a new element by tag name, and add it as this Element's first child.Element
Element. prependElement(java.lang.String tagName, java.lang.String namespace)
Create a new element by tag name and namespace, and add it as this Element's first child.Element
Element. prependText(java.lang.String text)
Create and prepend a new TextNode to this element.Element
Element. previousElementSibling()
Gets the previous element sibling of this element.Element
Element. removeAttr(java.lang.String attributeKey)
Element
Element. removeClass(java.lang.String className)
Remove a class name from this element'sclass
attribute.Element
Element. root()
Element
Element. selectFirst(java.lang.String cssQuery)
Find the first Element that matches theSelector
CSS query, with this element as the starting context.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
Element. shallowClone()
Element
Element. tagName(java.lang.String tagName)
Change (rename) the tag of this element.Element
Element. tagName(java.lang.String tagName, java.lang.String namespace)
Change (rename) the tag of this element.Element
Document. text(java.lang.String text)
Set the text of thebody
of this document.Element
Element. text(java.lang.String text)
Set the text of this element.Element
Element. toggleClass(java.lang.String className)
Toggle a class name on this element'sclass
attribute: if present, remove it; otherwise add it.Element
Element. traverse(NodeVisitor nodeVisitor)
Element
Element. val(java.lang.String value)
Set the value of a form element (input, textarea, etc).Element
Element. wrap(java.lang.String html)
Wrap the supplied HTML around this element.Methods in org.jsoup.nodes that return types with arguments of type Element Modifier and Type Method Description (package private) java.util.List<Element>
Element. childElementsList()
Maintains a shadow copy of this element's child elements.java.util.stream.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 Element Modifier and Type Method Description FormElement
FormElement. addElement(Element element)
Add a form control element to this form.Element
Element. appendTo(Element parent)
Add this element to the supplied parent element, as its next child.private Element
Node. getDeepChild(Element el)
private static <E extends Element>
intElement. indexInList(Element search, java.util.List<E> elements)
private static java.lang.String
Element. searchUpForAttribute(Element start, java.lang.String key)
(package private) static <T extends Node>
java.util.List<T>NodeUtils. selectXpath(java.lang.String xpath, Element el, java.lang.Class<T> nodeType)
This impl works by compiling the input xpath expression, and then evaluating it against a W3C Document converted from the original jsoup element.Method parameters in org.jsoup.nodes with type arguments of type Element Modifier and Type Method Description Element
Element. forEach(java.util.function.Consumer<? super Element> action)
Deprecated.usestream()
.forEach(Consumer)
instead.Constructors in org.jsoup.nodes with parameters of type Element Constructor Description NodeList(Element owner, int initialCapacity)
-
Uses of Element in org.jsoup.parser
Fields in org.jsoup.parser declared as Element Modifier and Type Field Description private Element
HtmlTreeBuilder. contextElement
private Element
HtmlTreeBuilder. headElement
Fields in org.jsoup.parser with type parameters of type Element Modifier and Type Field Description private java.util.ArrayList<Element>
HtmlTreeBuilder. formattingElements
(package private) java.util.ArrayList<Element>
TreeBuilder. stack
Methods in org.jsoup.parser that return Element Modifier and Type Method Description (package private) Element
HtmlTreeBuilder. aboveOnStack(Element el)
(package private) Element
HtmlTreeBuilder. createElementFor(Token.StartTag startTag, java.lang.String namespace, boolean forcePreserveCase)
(package private) Element
TreeBuilder. currentElement()
Get the current element (last on the stack).(package private) Element
HtmlTreeBuilder. getActiveFormattingElement(java.lang.String nodeName)
(package private) Element
HtmlTreeBuilder. getFromStack(java.lang.String elName)
Gets the nearest (lowest) HTML element with the given name from the stack.(package private) Element
HtmlTreeBuilder. getHeadElement()
(package private) Element
HtmlTreeBuilder. insertElementFor(Token.StartTag startTag)
Inserts an HTML element for the given tag)(package private) Element
HtmlTreeBuilder. insertEmptyElementFor(Token.StartTag startTag)
(package private) Element
HtmlTreeBuilder. insertForeignElementFor(Token.StartTag startTag, java.lang.String namespace)
Inserts a foreign element.(package private) Element
HtmlTreeBuilder. lastFormattingElement()
(package private) Element
TreeBuilder. pop()
Removes the last Element from the stack, hits onNodeClosed, and then returns it.(package private) Element
HtmlTreeBuilder. popStackToClose(java.lang.String elName)
Pops the stack until the given HTML element is removed.(package private) Element
HtmlTreeBuilder. popStackToCloseAnyNamespace(java.lang.String elName)
Pops the stack until an element with the supplied name is removed, irrespective of namespace.(package private) Element
HtmlTreeBuilder. removeLastFormattingElement()
Methods in org.jsoup.parser that return types with arguments of type Element Modifier and Type Method Description (package private) java.util.ArrayList<Element>
HtmlTreeBuilder. getStack()
Methods in org.jsoup.parser with parameters of type Element Modifier and Type Method Description (package private) Element
HtmlTreeBuilder. aboveOnStack(Element el)
(package private) void
HtmlTreeBuilder. checkActiveFormattingElements(Element in)
private void
HtmlTreeBuilder. doInsertElement(Element el, Token token)
Inserts the Element onto the stack.(package private) void
HtmlTreeBuilder. insertCharacterToElement(Token.Character characterToken, Element el)
Inserts the provided character token into the provided element.(package private) void
HtmlTreeBuilder. insertOnStackAfter(Element after, Element in)
(package private) static boolean
HtmlTreeBuilder. isHtmlIntegration(Element el)
(package private) boolean
HtmlTreeBuilder. isInActiveFormattingElements(Element el)
(package private) static boolean
HtmlTreeBuilder. isMathmlTextIntegration(Element el)
private static boolean
HtmlTreeBuilder. isSameFormattingElement(Element a, Element b)
(package private) static boolean
HtmlTreeBuilder. isSpecial(Element el)
(package private) void
HtmlTreeBuilder. maybeSetBaseUri(Element base)
private static boolean
HtmlTreeBuilder. onStack(java.util.ArrayList<Element> queue, Element element)
(package private) boolean
HtmlTreeBuilder. onStack(Element el)
(package private) java.util.List<Node>
HtmlTreeBuilder. parseFragment(java.lang.String inputFragment, Element context, java.lang.String baseUri, Parser parser)
static java.util.List<Node>
Parser. parseFragment(java.lang.String fragmentHtml, Element context, java.lang.String baseUri)
Parse a fragment of HTML into a list of nodes.static java.util.List<Node>
Parser. parseFragment(java.lang.String fragmentHtml, Element context, java.lang.String baseUri, ParseErrorList errorList)
Parse a fragment of HTML into a list of nodes.(package private) abstract java.util.List<Node>
TreeBuilder. parseFragment(java.lang.String inputFragment, Element context, java.lang.String baseUri, Parser parser)
(package private) java.util.List<Node>
XmlTreeBuilder. parseFragment(java.lang.String inputFragment, Element context, java.lang.String baseUri, Parser parser)
java.util.List<Node>
Parser. parseFragmentInput(java.lang.String fragment, Element context, java.lang.String baseUri)
(package private) int
HtmlTreeBuilder. positionOfElement(Element el)
(package private) void
TreeBuilder. push(Element element)
Adds the specified Element to the end of the stack, and hits onNodeInserted.(package private) void
HtmlTreeBuilder. pushActiveFormattingElements(Element in)
(package private) void
HtmlTreeBuilder. pushWithBookmark(Element in, int bookmark)
(package private) void
HtmlTreeBuilder. removeFromActiveFormattingElements(Element el)
(package private) boolean
HtmlTreeBuilder. removeFromStack(Element el)
(package private) void
HtmlTreeBuilder. replaceActiveFormattingElement(Element out, Element in)
private static void
HtmlTreeBuilder. replaceInQueue(java.util.ArrayList<Element> queue, Element out, Element in)
(package private) void
HtmlTreeBuilder. replaceOnStack(Element out, Element in)
(package private) void
HtmlTreeBuilder. setHeadElement(Element headElement)
Method parameters in org.jsoup.parser with type arguments of type Element Modifier and Type Method Description private static boolean
HtmlTreeBuilder. onStack(java.util.ArrayList<Element> queue, Element element)
private static void
HtmlTreeBuilder. replaceInQueue(java.util.ArrayList<Element> queue, Element out, Element in)
-
Uses of Element in org.jsoup.safety
Fields in org.jsoup.safety declared as Element Modifier and Type Field Description private Element
Cleaner.CleaningVisitor. destination
(package private) Element
Cleaner.ElementMeta. el
private Element
Cleaner.CleaningVisitor. root
Methods in org.jsoup.safety with parameters of type Element Modifier and Type Method Description private int
Cleaner. copySafeNodes(Element source, Element dest)
private Cleaner.ElementMeta
Cleaner. createSafeElement(Element sourceEl)
boolean
Safelist. isSafeAttribute(java.lang.String tagName, Element el, Attribute attr)
Test if the supplied attribute is allowed by this safelist for this tag.private boolean
Safelist. testValidProtocol(Element el, Attribute attr, java.util.Set<Safelist.Protocol> protocols)
Constructors in org.jsoup.safety with parameters of type Element Constructor Description CleaningVisitor(Element root, Element destination)
ElementMeta(Element el, int numAttribsDiscarded)
-
Uses of Element in org.jsoup.select
Fields in org.jsoup.select with type parameters of type Element Modifier and Type Field Description (package private) static java.lang.ThreadLocal<NodeIterator<Element>>
StructuralEvaluator.Has. ThreadElementIter
(package private) java.lang.ThreadLocal<java.util.IdentityHashMap<Element,java.util.IdentityHashMap<Element,java.lang.Boolean>>>
StructuralEvaluator. threadMemo
(package private) java.lang.ThreadLocal<java.util.IdentityHashMap<Element,java.util.IdentityHashMap<Element,java.lang.Boolean>>>
StructuralEvaluator. threadMemo
Methods in org.jsoup.select that return Element Modifier and Type Method Description static Element
Collector. findFirst(Evaluator eval, Element root)
Finds the first Element that matches the Evaluator that descends from the root, and stops the query once that first match is found.Element
Elements. first()
Get the first matched element.Element
Elements. last()
Get the last matched element.Element
Elements. remove(int index)
Remove the Element at the specified index in this ist, and from the DOM.static Element
Selector. selectFirst(java.lang.String cssQuery, Element root)
Find the first element that matches the query.Element
Elements. set(int index, Element element)
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 Element Modifier and Type Method Description java.util.function.Predicate<Element>
Evaluator. asPredicate(Element root)
Provides a Predicate for this Evaluator, matching the test Element.Methods in org.jsoup.select with parameters of type Element Modifier and Type Method Description java.util.function.Predicate<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
Collector. collect(Evaluator eval, Element root)
Build a list of elements, by visiting root and every descendant of root, and testing it against the evaluator.static Element
Collector. findFirst(Evaluator eval, Element root)
Finds the first Element that matches the Evaluator that descends from the root, and stops the query once that first match is found.boolean
CombiningEvaluator.And. matches(Element root, Element element)
boolean
CombiningEvaluator.Or. matches(Element root, Element node)
boolean
Evaluator.AllElements. matches(Element root, Element element)
boolean
Evaluator.Attribute. matches(Element root, Element element)
boolean
Evaluator.AttributeStarting. matches(Element root, Element element)
boolean
Evaluator.AttributeWithValue. matches(Element root, Element element)
boolean
Evaluator.AttributeWithValueContaining. matches(Element root, Element element)
boolean
Evaluator.AttributeWithValueEnding. matches(Element root, Element element)
boolean
Evaluator.AttributeWithValueMatching. matches(Element root, Element element)
boolean
Evaluator.AttributeWithValueNot. matches(Element root, Element element)
boolean
Evaluator.AttributeWithValueStarting. matches(Element root, Element element)
boolean
Evaluator.Class. matches(Element root, Element element)
boolean
Evaluator.ContainsData. matches(Element root, Element element)
boolean
Evaluator.ContainsOwnText. matches(Element root, Element element)
boolean
Evaluator.ContainsText. matches(Element root, Element element)
boolean
Evaluator.ContainsWholeOwnText. matches(Element root, Element element)
boolean
Evaluator.ContainsWholeText. matches(Element root, Element element)
boolean
Evaluator.CssNthEvaluator. matches(Element root, Element element)
boolean
Evaluator.Id. matches(Element root, Element element)
boolean
Evaluator.IndexEquals. matches(Element root, Element element)
boolean
Evaluator.IndexGreaterThan. matches(Element root, Element element)
boolean
Evaluator.IndexLessThan. matches(Element root, Element element)
boolean
Evaluator.IsEmpty. matches(Element root, Element element)
boolean
Evaluator.IsFirstChild. matches(Element root, Element element)
boolean
Evaluator.IsLastChild. matches(Element root, Element element)
boolean
Evaluator.IsOnlyChild. matches(Element root, Element element)
boolean
Evaluator.IsOnlyOfType. matches(Element root, Element element)
boolean
Evaluator.IsRoot. matches(Element root, Element element)
abstract boolean
Evaluator. matches(Element root, Element element)
Test if the element meets the evaluator's requirements.boolean
Evaluator.Matches. matches(Element root, Element element)
boolean
Evaluator.MatchesOwn. matches(Element root, Element element)
boolean
Evaluator.MatchesWholeOwnText. matches(Element root, Element element)
boolean
Evaluator.MatchesWholeText. matches(Element root, Element element)
boolean
Evaluator.MatchText. matches(Element root, Element element)
boolean
Evaluator.Tag. matches(Element root, Element element)
boolean
Evaluator.TagEndsWith. matches(Element root, Element element)
boolean
StructuralEvaluator.Has. matches(Element root, Element element)
boolean
StructuralEvaluator.ImmediateParent. matches(Element root, Element element)
Deprecated.boolean
StructuralEvaluator.ImmediateParentRun. matches(Element root, Element element)
boolean
StructuralEvaluator.ImmediatePreviousSibling. matches(Element root, Element element)
boolean
StructuralEvaluator.Is. matches(Element root, Element element)
boolean
StructuralEvaluator.Not. matches(Element root, Element element)
boolean
StructuralEvaluator.Parent. matches(Element root, Element element)
boolean
StructuralEvaluator.PreviousSibling. matches(Element root, Element element)
boolean
StructuralEvaluator.Root. matches(Element root, Element element)
(package private) boolean
StructuralEvaluator. memoMatches(Element root, Element element)
static Elements
Selector. select(java.lang.String query, Element root)
Find elements matching selector.static Elements
Selector. select(Evaluator evaluator, Element root)
Find elements matching selector.static Element
Selector. selectFirst(java.lang.String cssQuery, Element root)
Find the first element that matches the query.Element
Elements. set(int index, Element element)
Replace the Element at the specified index in this list, and in the DOM.Method parameters in org.jsoup.select with type arguments of type Element Modifier and Type Method Description (package private) static Elements
Selector. filterOut(java.util.Collection<Element> elements, java.util.Collection<Element> outs)
boolean
Elements. removeIf(java.util.function.Predicate<? super Element> filter)
Remove from the list, and from the DOM, all elements in this list that mach the given filter.void
Elements. replaceAll(java.util.function.UnaryOperator<Element> operator)
Replace each element in this list with the result of the operator, and update the DOM.static Elements
Selector. select(java.lang.String query, java.lang.Iterable<Element> roots)
Find elements matching selector.Constructors in org.jsoup.select with parameters of type Element Constructor Description Elements(Element... elements)
Constructor parameters in org.jsoup.select with type arguments of type Element Constructor Description Elements(java.util.Collection<Element> elements)
Elements(java.util.List<Element> elements)
-