How can I remove a tag from a node while I'm looping through the node collection
I'm in the loop through a complex document with
For Each node As HtmlNode In document.DocumentNode.SelectNodes("//section/div[3]/section/article")
then I get an address string which I split in this way
adress = Split(node.SelectSingleNode("./div[2]/div").InnerHtml, "<br>")
But sometimes I have some advertising in this address which is coming from a tooltip which always starts with a "span" Tag How can I remove this before I split the result from the node?
example before I split the result looks normally
88989 <br> myCity <br> mySTreet <br> address
in some cases the result looks like
88989 <br> myCity <span>mycity is a nice city<br> Visit us </span> <br> mySTreet <br> address
Ok, got it to work with
Dim ChildNode As HtmlNode
For Each node As HtmlNode In document.DocumentNode.SelectNodes("//section/div[3]/section/article")
Dim code = ChildNode.SelectSingleNode("./span")
ChildNode.RemoveChild(code, False)
...