是否有可能找到只有anchor(和可選空白)的段落作爲使用XPath的子項?我可以得到「// p [a和not(* [not(self :: a)]或text())]」,如果段落和錨點標記之間沒有任何空格,則可以很好地工作。我可以使用xpath查找僅帶錨點的段落嗎?
舉一些具體的例子,我想有一個查詢,將匹配這些(目前只匹配第一個):
<p><a>link</a></p> <p> <a>link with leading spaces</a></p> <p><a>link with trailing spaces</a> </p> <p> <a>link with leading and trailing spaces</a> </p>但不匹配這些:
<p>Intro text <a>link</a> outro text.</p> <p><a>link</a> outro text.</p> <p>Intro text <a>link</a></p>
到目前爲止,我喜歡這個簡單! – 2013-03-13 16:04:40