I am trying to extract some data from a website using a LINQ statement, the XML is in the following form.
<parent>
<p>
<b>
Title
</b>
</p>
<p>
blurb
</p>
<p>
<b>
As Of Date
</b>
</p>
<center>
<table>
<tr>
<th>
Header
</th>
</tr>
<tr>
<td>
Data
</td>
</tr>
</table>
</center>
<p>
<b>
As Of Date
</b>
</p>
<center>
<table>
<tr>
<th>
Header
</th>
</tr>
<tr>
<td>
Data
</td>
</tr>
</table>
</center>
</p>
I would like to get the As Of Date and Data (the data row is iterated several times). Also the table and as of date appear several times in the document (the table is active from a date).
I can get the rows using the following LINQ but how do I get the As Of Date
Dim l_PricesTable = From rows In l_Xml.Descendants("tr") _
Where ((rows.Descendants("td") IsNot Nothing) AndAlso (rows.Descendants("td").Count >= 1)) _
Select Data = rows.Descendants("td")(0).Value,
AsOfDate = ???
I have no way of changing the XML as it is a 3rd party source. There is no XML element which contains just the as of date and also the table, they are all under the one parent node.
I am confident in C# and VB.Net so any solution is OK.
Any help would be appreciated.
Thanks
Dave