Xpath - get only node content without other elements

后端 未结 4 1971
暖寄归人
暖寄归人 2020-12-14 06:20

I have an div elemet:

This is some text

This is a title

Some other content
<
4条回答
  •  一整个雨季
    2020-12-14 06:42

    What xpath expression should I use to only get the div content without his child elements h1 and div

    This XPath expression:

    /div/node()[not(self::h1|self::div)]
    

    It selects every div root element's children except those h1 or div elements.

提交回复
热议问题