假設下面的標記所有空元素:如何使用XPath選擇
<html>
<body>
<p>
<strong> </strong>
<strong>
</strong>
<strong><em>Bar</em> </strong>
<strong><em> </em> </strong>
</p>
</body>
</html>
我怎樣才能用XPath查詢以下元素?
<strong> </strong>
<strong>
</strong>
<strong><em> </em> </strong>
我以爲它會像//*[normalize-space(text()) = '' and not(node())]
的第一兩種情況,但事實並非如此。而且我不知道如何捕捉第三種情況。
更確切地說:我正在搜索所有隻包含空白,新行和子節點的節點。
http://stackoverflow.com/questions/8688185/xpath-select-tag-with-empty價值 請檢查以上職位。希望能幫助到你。 – TonalLynx 2015-04-05 15:08:36