Is there a way to extract the source of an image in an HTML file using only one struct (with encode/xml
)? Now I have something like this
type XML struct {
A Image `xml:"div>img"`
}
type Image struct {
I string `xml:"src,attr"`
}
And would be great to only declare something like this :
type Image struct {
I string `xml:"div>img,src,attr"`
}
This is the HTML :
<div><div><img src="hello.png"/></div></div>