This week's book giveaway is in the Java in General forum.
We're giving away four copies of Helidon Revealed: A Practical Guide to Oracle’s Microservices Framework and have Michael Redlich on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

XPath doubt.

 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sku != preceding::sku
Returns true if there is at least one child sku element with a string-value that does not equal that os one of the preceding sku elements.
not(sku = preceding::sku)
Return true if there is not a single child sku element with a string-value that equals that of one of the preceding sku elements.

In XML Quick Reference , they say these two are not equal. How ?

Micheal
 
Ranch Hand
Posts: 400
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The ! and not do seem a little strange in xpath and need to be read carefully. It's one of the common gotchas.
Consider the following 2 xpaths:-

1) //author[ @age != "34" ]
2) //author[ not(@age = "34") ]
The first example selects all author element nodes whose age attributes' do not equal 34.
The second will select all authors that do not have an age attribute whose value is 34 OR who do not have an age attribute.
So an element like <author></author>
will be selected by xpath 2 but not by xpath 1.
You need to read the xpath carefully:-
1) select all author elements where the age attribute is not equal to 34.

2)all author elements which do not have an age attribute with the value 34.
 
It's fun to be me, and still legal in 9 states! Wanna see my tiny ad?
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic