Extract html-content from string with tags

Hi,

i have a string with HTML

Example:

<h1>Name of Topic</h1>
<p>a long text</p>
<p>another long test</p>
<span>short description</span><
<a href="#"><i>Icon</i> Click</a> 

How can i get this string get in a map?

Example:

mytag[0]["tag"] = "h1" //htmlTag
mytag[0]["text"] = "Name of Topic" //content
mytag[1]["tag"] = "p" //htmlTag
mytag[1]["text"] = "a long text" //content

Do you have any ideas or approaches?

May be this will help?
https://godoc.org/golang.org/x/net/html

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.