|
iText 7 7.1.8 API
|
A HTML element consists of a tag name, attributes, and child nodes (including text nodes and other elements). More...
Public Member Functions |
|
| Element (iText.StyledXmlParser.Jsoup.Parser.Tag tag, String baseUri, Attributes attributes) | |
| Create a new, standalone Element. More... |
|
| Element (iText.StyledXmlParser.Jsoup.Parser.Tag tag, String baseUri) | |
| Create a new Element from a tag and a base URI. More... |
|
| override String | NodeName () |
| Get the node name of this node. More... |
|
| virtual String | TagName () |
| Get the name of the tag for this element. More... |
|
| virtual iText.StyledXmlParser.Jsoup.Nodes.Element | TagName (String tagName) |
| Change the tag of this element. More... |
|
| virtual iText.StyledXmlParser.Jsoup.Parser.Tag | Tag () |
| Get the Tag for this element. More... |
|
| virtual bool | IsBlock () |
| Test if this element is a block-level element. More... |
|
| virtual String | Id () |
Get the id attribute of this element. More... |
|
| override iText.StyledXmlParser.Jsoup.Nodes.Node | Attr (String attributeKey, String attributeValue) |
| Set an attribute value on this element. More... |
|
| virtual iText.StyledXmlParser.Jsoup.Nodes.Element | Attr (String attributeKey, bool attributeValue) |
| Set a boolean attribute value on this element. More... |
|
| virtual IDictionary< String, String > | Dataset () |
| Get this element's HTML5 custom data attributes. More... |
|
| sealed override iText.StyledXmlParser.Jsoup.Nodes.Node | Parent () |
| Gets this node's parent node. More... |
|
| virtual Elements | Parents () |
| Get this element's parent and ancestors, up to the document root. More... |
|
| virtual iText.StyledXmlParser.Jsoup.Nodes.Element | Child (int index) |
| Get a child element of this element, by its 0-based index number. More... |
|
| virtual Elements | Children () |
| Get this element's child elements. More... |
|
| virtual IList< TextNode > | TextNodes () |
| Get this element's child text nodes. More... |
|
| virtual IList< DataNode > | DataNodes () |
| Get this element's child data nodes. More... |
|
| virtual Elements | Select (String cssQuery) |
| Find elements that match the iText.StyledXmlParser.Jsoup.Select.Selector CSS query, with this element as the starting context. Matched elements may include this element, or any of its children. More... |
|
| virtual iText.StyledXmlParser.Jsoup.Nodes.Element | AppendChild (iText.StyledXmlParser.Jsoup.Nodes.Node child) |
| Add a node child node to this element. More... |
|
| virtual iText.StyledXmlParser.Jsoup.Nodes.Element | PrependChild (iText.StyledXmlParser.Jsoup.Nodes.Node child) |
| Add a node to the start of this element's children. More... |
|
| virtual iText.StyledXmlParser.Jsoup.Nodes.Element | InsertChild (int index, iText.StyledXmlParser.Jsoup.Nodes.Node child) |
| Inserts the given child node into this element at the specified index. More... |
|
| virtual iText.StyledXmlParser.Jsoup.Nodes.Element | InsertChildren< _T0 > (int index, ICollection< _T0 > children) |
| Inserts the given child nodes into this element at the specified index. More... |
|
| virtual iText.StyledXmlParser.Jsoup.Nodes.Element | AppendElement (String tagName) |
| Create a new element by tag name, and add it as the last child. More... |
|
| virtual iText.StyledXmlParser.Jsoup.Nodes.Element | PrependElement (String tagName) |
| Create a new element by tag name, and add it as the first child. More... |
|
| virtual iText.StyledXmlParser.Jsoup.Nodes.Element | AppendText (String text) |
| Create and append a new TextNode to this element. More... |
|
| virtual iText.StyledXmlParser.Jsoup.Nodes.Element | PrependText (String text) |
| Create and prepend a new TextNode to this element. More... |
|
| virtual iText.StyledXmlParser.Jsoup.Nodes.Element | Append (String html) |
| Add inner HTML to this element. More... |
|
| virtual iText.StyledXmlParser.Jsoup.Nodes.Element | Prepend (String html) |
| Add inner HTML into this element. More... |
|
| override iText.StyledXmlParser.Jsoup.Nodes.Node | Before (String html) |
| Insert the specified HTML into the DOM before this element (as a preceding sibling). More... |
|
| override iText.StyledXmlParser.Jsoup.Nodes.Node | Before (iText.StyledXmlParser.Jsoup.Nodes.Node node) |
| Insert the specified node into the DOM before this node (as a preceding sibling). More... |
|
| override iText.StyledXmlParser.Jsoup.Nodes.Node | After (String html) |
| Insert the specified HTML into the DOM after this element (as a following sibling). More... |
|
| override iText.StyledXmlParser.Jsoup.Nodes.Node | After (iText.StyledXmlParser.Jsoup.Nodes.Node node) |
| Insert the specified node into the DOM after this node (as a following sibling). More... |
|
| virtual iText.StyledXmlParser.Jsoup.Nodes.Element | Empty () |
| Remove all of the element's child nodes. More... |
|
| override iText.StyledXmlParser.Jsoup.Nodes.Node | Wrap (String html) |
| Wrap the supplied HTML around this element. More... |
|
| virtual String | CssSelector () |
| Get a CSS selector that will uniquely select this element. More... |
|
| virtual Elements | SiblingElements () |
| Get sibling elements. More... |
|
| virtual iText.StyledXmlParser.Jsoup.Nodes.Element | NextElementSibling () |
| Gets the next sibling element of this element. More... |
|
| virtual iText.StyledXmlParser.Jsoup.Nodes.Element | PreviousElementSibling () |
| Gets the previous element sibling of this element. More... |
|
| virtual iText.StyledXmlParser.Jsoup.Nodes.Element | FirstElementSibling () |
| Gets the first element sibling of this element. More... |
|
| virtual int | ElementSiblingIndex () |
| Get the list index of this element in its element sibling list. More... |
|
| virtual iText.StyledXmlParser.Jsoup.Nodes.Element | LastElementSibling () |
| Gets the last element sibling of this element More... |
|
| virtual Elements | GetElementsByTag (String tagName) |
| Finds elements, including and recursively under this element, with the specified tag name. More... |
|
| virtual iText.StyledXmlParser.Jsoup.Nodes.Element | GetElementById (String id) |
| Find an element by ID, including or under this element. More... |
|
| virtual Elements | GetElementsByClass (String className) |
| Find elements that have this class, including or under this element. More... |
|
| virtual Elements | GetElementsByAttribute (String key) |
| Find elements that have a named attribute set. More... |
|
| virtual Elements | GetElementsByAttributeStarting (String keyPrefix) |
| Find elements that have an attribute name starting with the supplied prefix. More... |
|
| virtual Elements | GetElementsByAttributeValue (String key, String value) |
| Find elements that have an attribute with the specific value. More... |
|
| virtual Elements | GetElementsByAttributeValueNot (String key, String value) |
| Find elements that either do not have this attribute, or have it with a different value. More... |
|
| virtual Elements | GetElementsByAttributeValueStarting (String key, String valuePrefix) |
| Find elements that have attributes that start with the value prefix. More... |
|
| virtual Elements | GetElementsByAttributeValueEnding (String key, String valueSuffix) |
| Find elements that have attributes that end with the value suffix. More... |
|
| virtual Elements | GetElementsByAttributeValueContaining (String key, String match) |
| Find elements that have attributes whose value contains the match string. More... |
|
| virtual Elements | GetElementsByAttributeValueMatching (String key, Regex pattern) |
| Find elements that have attributes whose values match the supplied regular expression. More... |
|
| virtual Elements | GetElementsByAttributeValueMatching (String key, String regex) |
| Find elements that have attributes whose values match the supplied regular expression. More... |
|
| virtual Elements | GetElementsByIndexLessThan (int index) |
| Find elements whose sibling index is less than the supplied index. More... |
|
| virtual Elements | GetElementsByIndexGreaterThan (int index) |
| Find elements whose sibling index is greater than the supplied index. More... |
|
| virtual Elements | GetElementsByIndexEquals (int index) |
| Find elements whose sibling index is equal to the supplied index. More... |
|
| virtual Elements | GetElementsContainingText (String searchText) |
| Find elements that contain the specified string. More... |
|
| virtual Elements | GetElementsContainingOwnText (String searchText) |
| Find elements that directly contain the specified string. More... |
|
| virtual Elements | GetElementsMatchingText (Regex pattern) |
| Find elements whose text matches the supplied regular expression. More... |
|
| virtual Elements | GetElementsMatchingText (String regex) |
| Find elements whose text matches the supplied regular expression. More... |
|
| virtual Elements | GetElementsMatchingOwnText (Regex pattern) |
| Find elements whose own text matches the supplied regular expression. More... |
|
| virtual Elements | GetElementsMatchingOwnText (String regex) |
| Find elements whose text matches the supplied regular expression. More... |
|
| virtual Elements | GetAllElements () |
| Find all elements under this element (including self, and children of children). More... |
|
| virtual String | Text () |
| Gets the combined text of this element and all its children. More... |
|
| virtual String | OwnText () |
| Gets the text owned by this element only; does not get the combined text of all children. More... |
|
| virtual iText.StyledXmlParser.Jsoup.Nodes.Element | Text (String text) |
| Set the text of this element. More... |
|
| virtual bool | HasText () |
| Test if this element has any text content (that is not just whitespace). More... |
|
| virtual String | Data () |
| Get the combined data of this element. More... |
|
| virtual String | ClassName () |
| Gets the literal value of this element's "class" attribute, which may include multiple class names, space separated. More... |
|
| virtual ICollection< String > | ClassNames () |
| Get all of the element's class names. More... |
|
| virtual iText.StyledXmlParser.Jsoup.Nodes.Element | ClassNames (ICollection< String > classNames) |
Set the element's class attribute to the supplied class names. More... |
|
| virtual bool | HasClass (String className) |
| Tests if this element has a class. More... |
|
| virtual iText.StyledXmlParser.Jsoup.Nodes.Element | AddClass (String className) |
Add a class name to this element's class attribute. More... |
|
| virtual iText.StyledXmlParser.Jsoup.Nodes.Element | RemoveClass (String className) |
Remove a class name from this element's class attribute. More... |
|
| virtual iText.StyledXmlParser.Jsoup.Nodes.Element | ToggleClass (String className) |
Toggle a class name on this element's class attribute: if present, remove it; otherwise add it. More... |
|
| virtual String | Val () |
| Get the value of a form element (input, textarea, etc). More... |
|
| virtual iText.StyledXmlParser.Jsoup.Nodes.Element | Val (String value) |
| Set the value of a form element (input, textarea, etc). More... |
|
| virtual String | Html () |
| Retrieves the element's inner HTML. More... |
|
| override StringBuilder | Html (StringBuilder appendable) |
| Write this node and its children to the given System.Text.StringBuilder . More... |
|
| virtual iText.StyledXmlParser.Jsoup.Nodes.Element | Html (String html) |
| Set this element's inner HTML. More... |
|
| override String | ToString () |
| override Object | Clone () |
| Create a stand-alone, deep copy of this node, and all of its children. More... |
|
Public Member Functions inherited from iText.StyledXmlParser.Jsoup.Nodes.Node |
|
| virtual String | Attr (String attributeKey) |
| Get an attribute's value by its key. More... |
|
| virtual iText.StyledXmlParser.Jsoup.Nodes.Attributes | Attributes () |
| Get all of the element's attributes. More... |
|
| virtual bool | HasAttr (String attributeKey) |
| Test if this element has an attribute. More... |
|
| virtual iText.StyledXmlParser.Jsoup.Nodes.Node | RemoveAttr (String attributeKey) |
| Remove an attribute from this element. More... |
|
| virtual String | BaseUri () |
| Get the base URI of this node. More... |
|
| virtual void | SetBaseUri (String baseUri) |
| Update the base URI of this node and all of its descendants. More... |
|
| virtual String | AbsUrl (String attributeKey) |
| Get an absolute URL from a URL attribute that may be relative (i.e. More... |
|
| virtual iText.StyledXmlParser.Jsoup.Nodes.Node | ChildNode (int index) |
| Get a child node by its 0-based index. More... |
|
| virtual IList< iText.StyledXmlParser.Jsoup.Nodes.Node > | ChildNodes () |
| Get this node's children. More... |
|
| virtual IList< iText.StyledXmlParser.Jsoup.Nodes.Node > | ChildNodesCopy () |
| Returns a deep copy of this node's children. More... |
|
| int | ChildNodeSize () |
| Get the number of child nodes that this node holds. More... |
|
| iText.StyledXmlParser.Jsoup.Nodes.Node | ParentNode () |
| Gets this node's parent node. More... |
|
| virtual Document | OwnerDocument () |
| Gets the Document associated with this Node. More... |
|
| virtual void | Remove () |
| Remove (delete) this node from the DOM tree. More... |
|
| virtual iText.StyledXmlParser.Jsoup.Nodes.Node | Unwrap () |
| Removes this node from the DOM, and moves its children up into the node's parent. More... |
|
| virtual void | ReplaceWith (iText.StyledXmlParser.Jsoup.Nodes.Node @in) |
| Replace this node in the DOM with the supplied node. More... |
|
| virtual IList< iText.StyledXmlParser.Jsoup.Nodes.Node > | SiblingNodes () |
| Retrieves this node's sibling nodes. More... |
|
| virtual iText.StyledXmlParser.Jsoup.Nodes.Node | NextSibling () |
| Get this node's next sibling. More... |
|
| virtual iText.StyledXmlParser.Jsoup.Nodes.Node | PreviousSibling () |
| Get this node's previous sibling. More... |
|
| virtual int | SiblingIndex () |
| Get the list index of this node in its node sibling list. More... |
|
| virtual iText.StyledXmlParser.Jsoup.Nodes.Node | Traverse (NodeVisitor nodeVisitor) |
| Perform a depth-first traversal through this node and its descendants. More... |
|
| virtual String | OuterHtml () |
| Get the outer HTML of this node. More... |
|
| override String | ToString () |
| override bool | Equals (Object o) |
| Check if this node is the same instance of another (object identity test). More... |
|
| virtual bool | HasSameValue (Object o) |
| Check if this node is has the same content as another node. More... |
|
A HTML element consists of a tag name, attributes, and child nodes (including text nodes and other elements).
A HTML element consists of a tag name, attributes, and child nodes (including text nodes and other elements). From an Element, you can extract data, traverse the node graph, and manipulate the HTML.
|
inline |
|
inline |
Create a new Element from a tag and a base URI.
| tag | element tag |
| baseUri | the base URI of this element. It is acceptable for the base URI to be an empty string, but not null. |
|
inlinevirtual |
Add a class name to this element's class attribute.
| className | class name to add |
|
inlinevirtual |
Insert the specified node into the DOM after this node (as a following sibling).
| node | to add after this element |
Reimplemented from iText.StyledXmlParser.Jsoup.Nodes.Node.
|
inlinevirtual |
Insert the specified HTML into the DOM after this element (as a following sibling).
| html | HTML to add after this element |
Reimplemented from iText.StyledXmlParser.Jsoup.Nodes.Node.
|
inlinevirtual |
Add inner HTML to this element.
Add inner HTML to this element. The supplied HTML will be parsed, and each node appended to the end of the children.
| html | HTML to add inside this element, after the existing HTML |
|
inlinevirtual |
Add a node child node to this element.
| child | node to add. |
|
inlinevirtual |
Create a new element by tag name, and add it as the last child.
| tagName | the name of the tag (e.g. div ). |
parent.appendElement("h1").attr("id", "header").text("Welcome");
|
inlinevirtual |
Create and append a new TextNode to this element.
| text | the unencoded text to add |
|
inlinevirtual |
Set a boolean attribute value on this element.
Set a boolean attribute value on this element. Setting to
sets the attribute value to "" and marks the attribute as boolean so no value is written out. Setting to
removes the attribute with the same key if it exists.
| attributeKey | the attribute key |
| attributeValue | the attribute value |
|
inlinevirtual |
Set an attribute value on this element.
Set an attribute value on this element. If this element already has an attribute with the key, its value is updated; otherwise, a new attribute is added.
Reimplemented from iText.StyledXmlParser.Jsoup.Nodes.Node.
|
inlinevirtual |
Insert the specified node into the DOM before this node (as a preceding sibling).
| node | to add before this element |
Reimplemented from iText.StyledXmlParser.Jsoup.Nodes.Node.
|
inlinevirtual |
Insert the specified HTML into the DOM before this element (as a preceding sibling).
| html | HTML to add before this element |
Reimplemented from iText.StyledXmlParser.Jsoup.Nodes.Node.
|
inlinevirtual |
Get a child element of this element, by its 0-based index number.
Get a child element of this element, by its 0-based index number.
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.
| index | the index number of the element to retrieve |
IndexOutOfBoundsException
|
inlinevirtual |
Get this element's child elements.
Get this element's child elements.
This is effectively a filter on Node.ChildNodes() to get Element nodes.
|
inlinevirtual |
Gets the literal value of this element's "class" attribute, which may include multiple class names, space separated.
Gets the literal value of this element's "class" attribute, which may include multiple class names, space separated. (E.g. on
returns, "header gray")
|
inlinevirtual |
Get all of the element's class names.
Get all of the element's class names. E.g. on element "header", "gray" . Note that modifications to this set are not pushed to the backing class attribute; use the ClassNames(System.Collections.Generic.ICollection
|
inlinevirtual |
Set the element's class attribute to the supplied class names.
| classNames | set of classes |
|
inlinevirtual |
Create a stand-alone, deep copy of this node, and all of its children.
Create a stand-alone, deep copy of this node, and all of its children. The cloned node will have no siblings or parent node. As a stand-alone object, any changes made to the clone or any of its children will not impact the original node.
The cloned node may be adopted into another Document or node structure using Element.AppendChild(Node)
Reimplemented from iText.StyledXmlParser.Jsoup.Nodes.Node.
|
inlinevirtual |
Get a CSS selector that will uniquely select this element.
Get a CSS selector that will uniquely select this element.
If the element has an ID, returns #id; otherwise returns the parent (if any) CSS selector, followed by
|
inlinevirtual |
Get the combined data of this element.
Get the combined data of this element. Data is e.g. the inside of a script tag.
|
inlinevirtual |
Get this element's child data nodes.
Get this element's child data nodes. The list is unmodifiable but the data nodes may be manipulated.
This is effectively a filter on Node.ChildNodes() to get Data nodes.
|
inlinevirtual |
Get this element's HTML5 custom data attributes.
Get this element's HTML5 custom data attributes. Each attribute in the element that has a key starting with "data-" is included the dataset.
E.g., the element This map is a filtered view of the element's attribute map. Changes to one map (add, remove, update) are reflected in the other map. You can find elements that have data attributes using the package=jsoup, language=java
[^data-] attribute key prefix selector.
key=value custom data attributes.
|
inlinevirtual |
Get the list index of this element in its element sibling list.
Get the list index of this element in its element sibling list. I.e. if this is the first element sibling, returns 0.
|
inlinevirtual |
Remove all of the element's child nodes.
Remove all of the element's child nodes. Any attributes are left as-is.
|
inlinevirtual |
Gets the first element sibling of this element.
|
inlinevirtual |
Find all elements under this element (including self, and children of children).
|
inlinevirtual |
Find an element by ID, including or under this element.
Find an element by ID, including or under this element.
Note that this finds the first matching ID, starting with this element. If you search down from a different starting point, it is possible to find a different element by ID. For unique element by ID within a Document, use GetElementById(System.String)
| id | The ID to search for. |
|
inlinevirtual |
Find elements that have a named attribute set.
Find elements that have a named attribute set. Case insensitive.
| key | name of the attribute, e.g. href |
|
inlinevirtual |
Find elements that have an attribute name starting with the supplied prefix.
Find elements that have an attribute name starting with the supplied prefix. Use data- to find elements that have HTML5 datasets.
| keyPrefix | name prefix of the attribute e.g. data- |
|
inlinevirtual |
Find elements that have an attribute with the specific value.
Find elements that have an attribute with the specific value. Case insensitive.
| key | name of the attribute |
| value | value of the attribute |
|
inlinevirtual |
Find elements that have attributes whose value contains the match string.
Find elements that have attributes whose value contains the match string. Case insensitive.
| key | name of the attribute |
| match | substring of value to search for |
|
inlinevirtual |
Find elements that have attributes that end with the value suffix.
Find elements that have attributes that end with the value suffix. Case insensitive.
| key | name of the attribute |
| valueSuffix | end of the attribute value |
|
inlinevirtual |
Find elements that have attributes whose values match the supplied regular expression.
| key | name of the attribute |
| pattern | compiled regular expression to match against attribute values |
|
inlinevirtual |
Find elements that have attributes whose values match the supplied regular expression.
| key | name of the attribute |
| regex | regular expression to match against attribute values. You can use embedded flags (such as (?i) and (?m) to control regex options. |
|
inlinevirtual |
Find elements that either do not have this attribute, or have it with a different value.
Find elements that either do not have this attribute, or have it with a different value. Case insensitive.
| key | name of the attribute |
| value | value of the attribute |
|
inlinevirtual |
Find elements that have attributes that start with the value prefix.
Find elements that have attributes that start with the value prefix. Case insensitive.
| key | name of the attribute |
| valuePrefix | start of attribute value |
|
inlinevirtual |
Find elements that have this class, including or under this element.
Find elements that have this class, including or under this element. Case insensitive.
Elements can have multiple classes (e.g. el.getElementsByClass("header");
className
the name of the class to search for.
|
inlinevirtual |
Find elements whose sibling index is equal to the supplied index.
| index | 0-based index |
|
inlinevirtual |
Find elements whose sibling index is greater than the supplied index.
| index | 0-based index |
|
inlinevirtual |
Find elements whose sibling index is less than the supplied index.
| index | 0-based index |
|
inlinevirtual |
Finds elements, including and recursively under this element, with the specified tag name.
| tagName | The tag name to search for (case insensitively). |
|
inlinevirtual |
Find elements that directly contain the specified string.
Find elements that directly contain the specified string. The search is case insensitive. The text must appear directly in the element, not in any of its descendants.
| searchText | to look for in the element's own text |
|
inlinevirtual |
Find elements that contain the specified string.
Find elements that contain the specified string. The search is case insensitive. The text may appear directly in the element, or in any of its descendants.
| searchText | to look for in the element's text |
|
inlinevirtual |
Find elements whose own text matches the supplied regular expression.
| pattern | regular expression to match text against |
|
inlinevirtual |
Find elements whose text matches the supplied regular expression.
| regex | regular expression to match text against. You can use embedded flags (such as (?i) and (?m) to control regex options. |
|
inlinevirtual |
Find elements whose text matches the supplied regular expression.
| pattern | regular expression to match text against |
|
inlinevirtual |
Find elements whose text matches the supplied regular expression.
| regex | regular expression to match text against. You can use embedded flags (such as (?i) and (?m) to control regex options. |
|
inlinevirtual |
Tests if this element has a class.
Tests if this element has a class. Case insensitive.
| className | name of class to check for |
|
inlinevirtual |
Test if this element has any text content (that is not just whitespace).
|
inlinevirtual |
Retrieves the element's inner HTML.
Retrieves the element's inner HTML. E.g. on a , would return . (Whereas Node.OuterHtml() would return .)
|
inlinevirtual |
Set this element's inner HTML.
Set this element's inner HTML. Clears the existing HTML first.
| html | HTML to parse and set into this element |
|
inlinevirtual |
Write this node and its children to the given System.Text.StringBuilder .
Reimplemented from iText.StyledXmlParser.Jsoup.Nodes.Node.
|
inlinevirtual |
Get the id attribute of this element.
|
inlinevirtual |
Inserts the given child node into this element at the specified index.
Inserts the given child node into this element at the specified index. Current node will be shifted to the right. The inserted nodes will be moved from their current parent. To prevent moving, copy the node first.
| index | 0-based index to insert children at. Specify 0 to insert at the start, -1 at the end |
| child | child node to insert |
|
inlinevirtual |
Inserts the given child nodes into this element at the specified index.
Inserts the given child nodes into this element at the specified index. Current nodes will be shifted to the right. The inserted nodes will be moved from their current parent. To prevent moving, copy the nodes first.
| index | 0-based index to insert children at. Specify 0 to insert at the start, -1 at the end |
| children | child nodes to insert |
| _T0 | : | iText.StyledXmlParser.Jsoup.Nodes.Node |
|
inlinevirtual |
Test if this element is a block-level element.
Test if this element is a block-level element. (E.g. == false ).
|
inlinevirtual |
Gets the last element sibling of this element
|
inlinevirtual |
Gets the next sibling element of this element.
Gets the next sibling element of this element. E.g., if a div contains two p s, the nextElementSibling of the first p is the second p
This is similar to Node.NextSibling() , but specifically finds only Elements
|
inlinevirtual |
Get the node name of this node.
Get the node name of this node. Use for debugging purposes and not logic switching (for that, use instanceof).
Implements iText.StyledXmlParser.Jsoup.Nodes.Node.
|
inlinevirtual |
Gets the text owned by this element only; does not get the combined text of all children.
Gets the text owned by this element only; does not get the combined text of all children.
For example, given HTML Hello there now! , p.ownText() returns "Hello now!" , whereas p.text() returns "Hello there now!"Note that the text within the b element is not returned, as it is not a direct child of the p element.
|
inlinevirtual |
Gets this node's parent node.
Reimplemented from iText.StyledXmlParser.Jsoup.Nodes.Node.
|
inlinevirtual |
Get this element's parent and ancestors, up to the document root.
|
inlinevirtual |
Add inner HTML into this element.
Add inner HTML into this element. The supplied HTML will be parsed, and each node prepended to the start of the element's children.
| html | HTML to add inside this element, before the existing HTML |
|
inlinevirtual |
Add a node to the start of this element's children.
| child | node to add. |
|
inlinevirtual |
Create a new element by tag name, and add it as the first child.
| tagName | the name of the tag (e.g. div ). |
parent.prependElement("h1").attr("id", "header").text("Welcome");
|
inlinevirtual |
Create and prepend a new TextNode to this element.
| text | the unencoded text to add |
|
inlinevirtual |
Gets the previous element sibling of this element.
|
inlinevirtual |
Remove a class name from this element's class attribute.
| className | class name to remove |
|
inlinevirtual |
Find elements that match the iText.StyledXmlParser.Jsoup.Select.Selector CSS query, with this element as the starting context. Matched elements may include this element, or any of its children.
This method is generally more powerful to use than the DOM-type getElementBy* methods, because multiple filters can be combined, e.g.:
el.select("a[href]")
a tags with href attributes) el.select("a[href*=example.com]")
See the query syntax documentation in iText.StyledXmlParser.Jsoup.Select.Selector
| cssQuery | a iText.StyledXmlParser.Jsoup.Select.Selector CSS-like query |
| iText.StyledXmlParser.Jsoup.Select.Selector.SelectorParseException | (unchecked) on an invalid CSS query. |
|
inlinevirtual |
Get sibling elements.
Get sibling elements. If the element has no sibling elements, returns an empty list. An element is not a sibling of itself, so will not be included in the returned list.
|
inlinevirtual |
Get the Tag for this element.
|
inlinevirtual |
Get the name of the tag for this element.
Get the name of the tag for this element. E.g. div
|
inlinevirtual |
Change the tag of this element.
Change the tag of this element. For example, convert a to a el.tagName("div");
tagName
new tag name for this element
|
inlinevirtual |
Gets the combined text of this element and all its children.
Gets the combined text of this element and all its children. Whitespace is normalized and trimmed.
For example, given HTML Hello there now! , p.text() returns "Hello there now!"
|
inlinevirtual |
Set the text of this element.
Set the text of this element. Any existing contents (text or elements) will be cleared
| text | unencoded text |
Reimplemented in iText.StyledXmlParser.Jsoup.Nodes.Document.
|
inlinevirtual |
Get this element's child text nodes.
Get this element's child text nodes. The list is unmodifiable but the text nodes may be manipulated.
This is effectively a filter on Node.ChildNodes() to get Text nodes.
child text nodes. If this element has no text nodes, returns an empty list.
For example, with the input HTML: One Two Three with the
Fourp element selected:
|
inlinevirtual |
Toggle a class name on this element's class attribute: if present, remove it; otherwise add it.
| className | class name to toggle |
|
inlinevirtual |
Get the value of a form element (input, textarea, etc).
|
inlinevirtual |
Set the value of a form element (input, textarea, etc).
| value | value to set |
|
inlinevirtual |
Wrap the supplied HTML around this element.
| html | HTML to wrap around this element, e.g. . Can be arbitrarily deep. |
Reimplemented from iText.StyledXmlParser.Jsoup.Nodes.Node.