Html 如何使用XPath选择除单个节点之外的所有文本?

Html 如何使用XPath选择除单个节点之外的所有文本?,html,xml,xpath,Html,Xml,Xpath,给定以下XML: <div class="a"> some text i want to see <div class="b"> other text i want to see <div> <div class="c"> some text i DON'T WANT to see </div> some more text i wish to see.

给定以下XML:

<div class="a">
    some text i want to see
    <div class="b">
        other text i want to see
    <div>
    <div class="c">
        some text i DON'T WANT to see
    </div>  
    some more text i wish to see..
</div>
这个XPath

//div[@class="a"]//text()[not(parent::div[@class="c"])]
//div[@class="a"]//text()[not(parent::div[@class="c"]) and normalize-space()]
将选择所有不带
div的文本节点
@class=“c”

如果要排除纯空白文本节点,则此XPath

//div[@class="a"]//text()[not(parent::div[@class="c"])]
//div[@class="a"]//text()[not(parent::div[@class="c"]) and normalize-space()]
将选择这些文本节点

some text i want to see
other text i want to see
some more text i wish to see..

根据要求。

共享您当前的XPath