Exclude specific tag from selection in XPath

Viewed 51855

I know this is a simple question, but I can't figure it out. Consider the following simple XML document:

<root>
  <a></a>
  <b></b>
  <c></c>
  <a></a>
  <d></d>
  <e></e>
  <a></a>
  <a></a>
</root>

What's the best way to select the nodes <b> through <e> using XPath?

I'm looking for something like

/root/*[not(a)]

(which does not do the trick)

4 Answers

Have you tried:

/root/b|/root/c|root/d|/root/e

Related