str = getAttribute(tree,attr)
returns the attribute attr of the root node of
tree. If that attribute is not set, then the function returns a
missing value.
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:
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window.
Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: United States.
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.