Reputation: 2815
I have the following html markup :
<div>
<span id="391d0e73-d491-4e55-9ccb-b74c6923e070">This is a text
element</span>
</div>
Now if i save this div node in an HtmlNode
object and after that when i access node's FirstChild
then instead of giving span node as FirstChild
it gives the node NAME: "#text"
which is not present in the markup. Can please anybody help me out with this issue ?
Upvotes: 3
Views: 1847
Reputation: 107407
In XML, nodes include elements, text, comments etc, e.g. in your document, the div
can have 2 text
children:
<div>
text(1) Some text could be here
<span id="391d0e73-d491-4e55-9ccb-b74c6923e070">This is a text
element</span>
text(2) More text could be here
</div>
You need to specify that you want the span
child element on your HtmlNode
, e.g.
divNode.SelectSingleNode("span")
Upvotes: 3