How to select a node without attributes using xpath?
Let say that I have xml like this:
<root>
<node light="somevalue">message1</node>
<node dark="somevalue">message2</node>
<node>message3</node>
</root>
开发者_StackOverflow中文版With xpath usage I need to get "message3".
Does anybody know how I can achieve this?
I think you mean that you want to select nodes without attributes.
From XPath: How to select nodes which have no attributes?
//node[not(@*)]
This will select all nodes that do not have attributes.
/root/node[not(@*)]/text()
精彩评论