How to select all leaf nodes using XPath expression?

后端 未结 4 1428
傲寒
傲寒 2020-11-28 05:25

I believe it\'s possible but couldn\'t figure out the syntax. Something like this:

xmlNode.SelectNodes(\"//*[count(child::*) <= 1]\")

bu

4条回答
  •  情书的邮戳
    2020-11-28 06:16

    I'm adding this XSLT answer since it seems google's front matches lack such a solution:

    After a long struggle with extracting CDATA as XML, eventually, this expression worked best for me:

    
    

提交回复
热议问题