2012-12-07 26 views
-1

我正在寫一個小的vb應用程序來使用Html Agility Pack提取一些文本。如何使用XPATH提取粗體和罷工標籤?

我需要從html中提取一些標籤,而不是文本節點。

iParagraph是包含如下標籤的節點集合:strike,u,strong,b等。它還包含文本節點。我只需要跳過第一個文本節點,因爲我總是知道它是空的。這是因爲我在使用CKEditor。

如果您需要進一步解釋請詢問。我會澄清。

下面是我想要的樣本:

Dim paragraph = iParagraphNode.SelectNodes("//body/p and not([contains(text()]))") 
+0

如果您需要更多解釋,請詢問。我在這裏看看:http://xpath.alephzarro.com/content/cheatsheet.html和這裏:http://stackoverflow.com/questions/651783/how-do-i-select-only-visible-elements -using-xpath,但我不能想出一個選擇我想要的節點的好方法。 – Vyache

回答

0

的解決方案是不夠好,現在:

我就決定做以下跳到下一個節點:

Dim test = iParagraphNode.SelectNodes.FirstChild.NextSibling.Name = "tag"