I am trying to parse an xml. All nodes have opening and closing tags except one node that in some lines in only has this tag: <persons/>
In most of the time it appears like this: <persons> ... </persons>
I cannot get values from the xml when this node is not closing like this
Here is my code:
foreach (HtmlNode man in bm.SelectNodes(".//persons"))
{
//store values
}
How can I overcome this issue? Even if some nodes are like this at the start:
<persons> </persons>
if there is a tag like this in the middle of the file
<persons/>
I cannot get the remaining <persons> </persons>
values from the remaining lines
why are you using htmlnode? xmlnode would be just fine.
Or else, show more codes.
Did you step through the line? Did you encounter any error?
try this: