c# - XPath query not working(need find by text) -
Halo bop I am working with HTMLAgilitiePack and I have a problem that all elemnts require a single stracharer And with the duration of the text like the same class code, I have the quantity and date so I need to create a link like this
"// span (text = the amount of With) [div and (@ class, 'description' value)] "); I need to get 1,700,000.00 data from the div, which in the period with the 'zodiac' and 'Any ideas' from the div on 14.04.2014
I have it now
list & lt; String & gt; OriginalAmount = GetListDataFromHtmlSourse (pageadata, "//span [div and in (@ class, 'details')]"); Private Static List & lt; String & gt; GetListDataFromHtmlSourse (string HtmlSourse, string link) {list & lt; String & gt; Data = new list & lt; String & gt; (); HtmlAgilityPack.HtmlDocumentDocToParse = New HtmlAgilityPack.HtmlDocument (); DocToParse.LoadHtml (HtmlSourse); Foreach (HtmlNode node in DocToParse.DocumentNode.SelectNodes (link) {if (node.InnerText! = Null) Add (node.intext); } Return data; } And lieutenant; Div class = "deposit amount cellhit float" style = "height: 37px;" & Gt; & Lt; Span class = "detailsName darkgray" & gt; Amount & lt; / Span & gt; & Lt; Br> & Lt; Div class = "detailsValue float" style = "direction: RTL" & gt; 1,700,000.00 & lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; Div class = "boxcale light float" & gt; & Lt; Div square = "cellheit separatorvirative float" style = "height: 46px;" & Gt; & Lt; / Div & gt; & Lt; Div class = "deposit amount cellhigh float" style = "height: 40px;" & Gt; & Lt; Span class = "detailsName darkgray" & gt; Date & lt; / Span & gt; & Lt; Br> & Lt; Div class = "description value float" & gt; 14.04.2014 & lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt;
Actually, the question is not very clear. How about:
// span [. = 'Zodiac'] / low-sever :: div [(class @, 'detailsValue')]] top of XPath will search the equivalent of text with "zodiac" , then it According to your comment, if I do not think it wrong, please tell me, you want both values (after amount span and div after date period) Are there. Try this XPath: // span [. = 'Zodiac' or = 'Date'] / low-cycling :: div [in (class, 'description' value)]
Comments
Post a Comment