What you need is the InnerText
property of an XmlElement
.
Details and an example program:
https://msdn.microsoft.com/en-us/library/system.xml.xmlelement.innertext%28v=vs.110%29.aspx
UPDATE:
You may use HtmlElement
type as well. It also has InnerText
property.
You can also access the inner text by casting the HtmlElement
to one of the unmanaged MSHTML interfaces, e.g. IHTMLElement
which has the innerText
property.
You have to add Microsoft HTML Object Library
COM reference to your project.
(The file name is mshtml.tlb
.)
Here is an example:
For Each child As HtmlElement In element.Children
' using System.Windows.Forms.HtmlElement type
If (String.Equals(child.TagName, "div") AndAlso
String.Equals(child.GetAttribute("class"), "caption-line-time")) Then
Console.WriteLine("Time: {0}", child.InnerText)
End If
' using mshtml.IHTMLElement interface
Dim htmlElement As IHTMLElement = DirectCast(child.DomElement, IHTMLElement)
If (String.Equals(htmlElement.tagName, "div") AndAlso
String.Equals(htmlElement.className, "caption-line-time")) Then
Console.WriteLine("Time: {0}", htmlElement.innerText)
End If
Next