A typical HTML element contains the following components:
Element name – Name of the HTML tag. The element name corresponds to the
Name
property of the HTML tree.
Attributes – Additional information about the tag. HTML attributes have the
form
name
="value
"
,
where name
and
value
denote the attribute
name and value respectively. The attributes appear inside the opening HTML tag.
To get the attribute values from an HTML tree, use getAttribute
.
Content – Element content. The content appears between opening and closing
HTML tags. The content can be text data or nested HTML elements. To extract the
text from an htmlTree
object, use
extractHTMLText
. To get the nested HTML elements of an htmlTree
object, use
the Children
property.
For example, the HTML element <a
href="https://www.mathworks.com">Home</a>
comprises the following
components:
Component | Value | Description |
---|
Element name | a | Element is a hyperlink |
Attribute | Attribute name | href | Hyperlink reference |
Attribute value | "https://www.mathworks.com" | Hyperlink reference value |
Content | Home | Text to display |