3

Let say that I have xml like this:

<root>
    <node light="somevalue">message1</node>
    <node dark="somevalue">message2</node>
    <node>message3</node>
</root>

With xpath usage I need to get "message3".

Does anybody know how I can achieve this?

Răzvan Flavius Panda
  • 21,730
  • 17
  • 111
  • 169
truthseeker
  • 2,214
  • 6
  • 30
  • 53
  • Possible duplicate of [XPath: How to select nodes which have no attributes?](http://stackoverflow.com/questions/1323755/xpath-how-to-select-nodes-which-have-no-attributes) – Smandoli Dec 14 '16 at 15:05

2 Answers2

5

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.

Community
  • 1
  • 1
Ryan Berger
  • 9,644
  • 6
  • 44
  • 56
4
/root/node[not(@*)]/text()
Steven D. Majewski
  • 2,127
  • 15
  • 16