1

My html structure as below

<td class="opps">1:2</td>

I am trying split value of td with XPath as below

.//*[contains(@class, 'opps')]/text()[normalize-space(substring-after(., ':'))]
.//*[contains(@class, 'opps')]/text()[normalize-space(substring-before(., ':'))]

But value returns 1:2

How can i extract 1 and 2 separately?

I am also using HtmlNodeNavigator and HtmlAgilityPack.

What is the wrong?

Thank you in advance.

4

2 に答える 2

2

さらに検索した結果、解決策が見つかりました。

HtmlNodeNavigatorまたはXPathNavigatorを使用する場合、以下のように解決策が可能です

string _result1 = <HtmlNodeNavigator>.Evaluate("substring-after(.//*[contains(@class, 'opps')]/text(), ':')") as string; 
string _result2 = <XPathNavigator>.Evaluate("substring-before(.//*[contains(@class, 'opps')]/text(), ':')") as string;
于 2013-03-31T08:30:12.310 に答える