|
Generated by JDiff |
||||||||
| PREV PACKAGE NEXT PACKAGE FRAMES NO FRAMES | |||||||||
This file contains all the changes in documentation in the packagecom.itextpdf.styledxmlparser.jsoup.nodesas colored differences. Deletions are shownlike this, and additions are shown like this.
If no deletions or additions are shown in an entry, the HTML tags will be what has changed. The new HTML tags are shown in the differences. If no documentation existed, and then some was added in a later version, this change is noted in the appropriate class pages of differences, but the change is not shown on this page. Only changes in existing text are shown here. Similarly, documentation which was inherited from another class or interface is not shown here.
Note that an HTML error in the new documentation may cause the display of other documentation changes to be presented incorrectly. For instance, failure to close a tag will cause all subsequent paragraphs to be displayed differently.
The attributes of an Element.Attributes are treated as a map: there can be only one value associated with an attribute key.
Attribute key and value comparisons are done case insensitively, and keys are normalised to lower-case.
@author Jonathan Hedley, jonathan@hedley.net
Sets the charset used in this document. This method is equivalent to OutputSettings.charset(Charset) but in addition it updates the charset / encoding element within the document.Class Document, void updateMetaCharsetElement(boolean)This enables meta charset update.
If there's no element with charset / encoding information yet it will be created. Obsolete charset / encoding definitions are removed!
Elements used:
@param charset Charset @see #updateMetaCharsetElement(boolean) @see OutputSettings#charset(java.nio.charset.Charset)
- Html:
- Xml:
Sets whether the element with charset information in this document is updated on changes through Document.charset(Charset) or not.If set to false (default) there are no elements modified. @param update If true the element updated on charset changes, false if not @see #charset(java.nio.charset.Charset)
Get a child element of this element, by its 0-based index number.Class Element, Elements children()Note that an element can have both mixed Nodes and Elements as children. This method inspects a filtered list of children that are elements, and the index is based on that filtered list.
@param index the index number of the element to retrieve @return the child element, if it exists, otherwise throws an {@code IndexOutOfBoundsException} @see #childNode(int)
Get this element's child elements.Class Element, String cssSelector()This is effectively a filter on .childNodes() to get Element nodes.
@return child elements. If this element has no children, returns an empty list. @see #childNodes()
Get a CSS selector that will uniquely select this element.Class Element, ListIf the element has an ID, returns #id; otherwise returns the parent (if any) CSS selector, followed by {@literal '>'}, followed by a unique selector for the element (tag.class.class:nth-child(n)).
@return the CSS Path that can be used to retrieve the element in a selector.
Get this element's child data nodes. The list is unmodifiable but the data nodes may be manipulated.Class Element, Element nextElementSibling()This is effectively a filter on .childNodes() to get Data nodes.
@return child data nodes. If this element has no data nodes, returns an empty list. @see #data()
Gets the next sibling element of this element. E.g., if a {@code div} contains two {@code p}s, the {@code nextElementSibling} of the first {@code p} is the second {@code p}.Class Element, Elements select(String)This is similar to .nextSibling(), but specifically finds only
ElementsElements@return the next element, or null if there is no next element @see #previousElementSibling()
Find elements that match the Selector CSS query, with this element as the starting context. Matched elements may include this element, or any of its children.Class Element, ListThis method is generally more powerful to use than the DOM-type {@code getElementBy*} methods, because multiple filters can be combined, e.g.:
- {@code el.select("a[href]")} - finds links ({@code a} tags with {@code href} attributes)
- {@code el.select("a[href*=example.com]")} - finds links pointing to example.com (loosely)
See the query syntax documentation in Selector.@param cssQuery a Selector CSS-like query @return elements that match the query (empty if none match) @see Selector @throws Selector.SelectorParseException (unchecked) on an invalid CSS query.
Get this element's child text nodes. The list is unmodifiable but the text nodes may be manipulated.This is effectively a filter on .childNodes() to get Text nodes. @return child text nodes. If this element has no text nodes, returns an empty list.
For example, with the input HTML: {@code
One Two Three
} with the {@code p} element selected:
Four
- {@code p.text()} = {@code "One Two Three Four"}
- {@code p.ownText()} = {@code "One Three Four"}
- {@code p.children()} = {@code Elements[,
]}- {@code p.childNodes()} = {@code List
["One ", , " Three ",
, " Four"]}- {@code p.textNodes()} = {@code List
["One ", " Three ", " Four"]}
Get an absolute URL from a URL attribute that may be relative (i.e. anClass Node, String attr(String)or).E.g.:
String absUrl = linkEl.absUrl("href");If the attribute value is already absolute (i.e. it starts with a protocol, like
http://orhttps://etc), and it successfully parses as a URL, the attribute is returned directly. Otherwise, it is treated as a URL relative to the element's .baseUri, and made absolute using that.As an alternate, you can use the .attr method with the
abs:prefix, e.g.:String absUrl = linkEl.attr("abs:href");@param attributeKey The attribute key @return An absolute URL if one could be made, or an empty string (not null) if the attribute was missing or could not be made successfully into a URL. @see #attr @see java.net.URL#URL(java.net.URL, String)
Get an attribute's value by its key.Class Node, Node unwrap()To get an absolute URL from an attribute that may be a relative URL, prefix the key with
abs, which is a shortcut to the .absUrl method.E.g.:
@param attributeKey The attribute key. @return The attribute, or empty string if not present (to avoid nulls). @see #attributes() @see #hasAttr(String) @see #absUrl(String)String url = a.attr("abs:href");
Removes this node from the DOM, and moves its children up into the node's parent. This has the effect of dropping the node but keeping its children.For example, with the input html:
{@code
One Two Three}Calling {@code element.unwrap()} on the {@code span} element will result in the html:
{@code
One Two Three}and the {@code "Two "} TextNode being returned.
@return the first child of this node, after the node has been unwrapped. Null if the node had no children. @see #remove() @see #wrap(String)