I'm sending a GET request to a WMS service through angular's HttpClient. The response what I get is a html in string. How can I parse data from this string?
The response looks like this:
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head>
<body>
<p>Temperature 16.6 °C</p>
<p>Temperature 18.2 °C</p>
</body></html>
I need to get the values inside the paragraph tags. I found solutions only to display data through innerHtml directive, but this is not my case.
EDIT:
I found one possible solution through DOMParser:
const parser = new DOMParser();
const doc = parser.parseFromString(myHtmlStringResponse, "text/html");
const values = [];
const p = doc.getElementsByTagName("p");
for (const item of Array.from(p)) {
     values.push(item.textContent);
}

