HtmlParser

Last Updated On 2021-07-16

Version 1MinSDK 7Tutorial Video

Html Parser Component Can be used to fetch/modify data in a Html code.Html Code can be entered Manually, loaded from an Url or from an Html File in the Assets Folder.There are a lot of Functions Available. Check the docs to find more info.Each Block's Function is also added in the description of each block.



Methods

You can set the below method blocks in the blocks section of the builder.

AppendElementToElement

Create a new element by tag name, and add it as the last child.

AppendHtmlToElement

Add the supplied HTML to the end of the element's inner HTML.

AppendTextToElement

Create and append a new TextNode to this element.

CreateDocument

Create a main document. This Serves as the base html source.'input' can either be a html or an url

ElementHasAttribute

Checks if any of the matched elements have this attribute defined. Returns boolean

GetElementAttributeValue

Get an attribute value from the first matched element that has the attribute. Returns a String

GetElementById

Find an element by ID, including or under this element. Get an element from Document

GetElementChildAt

Get a child element of this element, by its 0-based index number. Returns an element

GetElementChildren

Get this element's child elements. Returns a YailList

GetElementClassName

Gets the literal value of this element's "class" attribute, which may include multiple class names, space separated. (E.g. on

returns, "header gray"). Returns a String

GetElementData

Get the combined data of this element. Data is e.g. the inside of a script tag. It returns contents of scripts, comments, CSS styles, etc. Returns a String

GetElementId

Get the id attribute of the element. Returns a String

GetElementInnerHtml

Get the combined inner HTML of all matched elements. Returns a String

GetElementOuterHtml

Get the combined outer HTML of all matched elements. Returns a String

GetElementTagName

Get the name of the tag for this element. E.g. div. If you are using case preserving parsing, this will return the source's original case. Returns a String

GetElementText

Get the combined text of all the matched elements. Returns a String

GetElementsByAttribute

Find elements that have a named attribute set. Case insensitive. Returns a list of Elements as YailList. The Yailist contains an element

GetElementsByClass

Find elements that have this class, including or under this element. Case insensitive. Returns a list of Elements as YailList. The Yailist contains an element

GetElementsByTag

Finds elements, including and recursively under this element, with the specified tag name. Returns a list of Elements as YailList. The Yailist contains an element

GetFirstElementSibling

Gets the first element sibling of the element. Returns an element

GetLastElementSibling

Gets the last element sibling of the element. Returns an element

GetNextElementSibling

Gets the next element sibling of the element. Returns an element

GetPreviousElementSibling

Gets the previous element sibling of the element. Returns an element

GetSiblingElements

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. Returns a list of Elements as YailList. The Yailist contains an element

PrependElementToElement

Create a new element by tag name, and add it as the first child.

PrependHtmlToElement

Add the supplied HTML to the start of the element's inner HTML.

PrependTextToElement

Create and prepend a new TextNode to this element.

SelectElementByQuery

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. 'source' should be a document, element or elements

SetElementAttributeValue

Set an attribute on all matched elements.

SetElementInnerHtml

Set the inner HTML of each matched element.

SetElementText

Set the Text of and Element

WrapHtmlToElement

Create and prepend a new TextNode to this element.


Events

You can set the below event blocks in the blocks section of the builder.

ErrorOccurred

Event for ErrorOccurred