Hi, So im trying to get a variable of type double from a book website, this is my current progress:
HtmlAgilityPack.HtmlDocument htmlDoc = new HtmlAgilityPack.HtmlDocument();
htmlDoc.OptionFixNestedTags = true;
var rootNode = htmlDoc.DocumentNode;
var bookResult = rootNode.SelectNodes("//div[@class='result-detail']");
var dataNode = bookResult.SelectSingleNode(".//div[@Class='item-price']");
var bookPriceNode = dataNode.SelectSingleNode(".//span1");
string bookPrice = bookPriceNode.InnerText.Trim();
the first problem is
Error 1 'HtmlAgilityPack.HtmlNodeCollection' does not contain a definition for 'SelectSingleNode' and no extension method 'SelectSingleNode' accepting a first argument of type 'HtmlAgilityPack.HtmlNodeCollection' could be found (are you missing a using directive or an assembly reference?)
and highlights the underlined code.
the second problem is im trying to convert the bookprice to double but then it wont let me use inner text.
how do i select the price content of span property? am I doing it right?
Below is the Div Class of what im trying to extract
<div class="result-detail">
<span property="url" content="http://www.abebooks.com/servlet/BookDetailsPL?bi=11698135711"></span>
<div class="item-price" typeof="Offer" property="offers">
<span property="price" content="41.95"></span>
<span property="priceCurrency" content="USD"></span>
<span property="itemCondition" content="UsedCondition"></span>
<span property="availability" content="InStock"></span>
</div>
Thanks alot. :)