I am using the htmlAgilityPack
to retrieve data from a table as so-
var text = from x in htmlDoc.DocumentNode.Descendants()
where x.Name == "p" && x.Attributes.Contains("class")
where x.Attributes["class"].Value == "cut"
select x.InnerText;
On debugging I can access the Results View
which shows all the parsed data I need to access. However I cannot figure out how to return
the data array that has been parsed.
How can I do this?
What you are returning is a simple string back to the variable text,so there is nothing to iterate or view the results(ResultsView).Remember you are not returning a IEnumerable object to use ResultViews.
I think you need this
var Result= from x in htmlDoc.DocumentNode.Descendants()
where x.Name == "p" && x.Attributes.Contains("class")
where x.Attributes["class"].Value == "cut"
foreach(var Item in Result){
//Access Item here.
}
If,not able to return
is only your problem then I believe it's quite simple..
var text=from x in htmlDoc.DocumentNode.Descendants()
where x.Name == "p" && x.Attributes.Contains("class")
where x.Attributes["class"].Value == "cut"
select x.InnerText;
//As the above query returns string,so you can check the result here..
Label1.text=text.ToString()