• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using AND operation in XPath

 
H Melua
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello

Assuming that I've got this XML File


and I want to search for all elements that contain particular <a> and <b> values... how do I do that in xpath? This for example checks each value seperately and returns the 2 sets of <a> and <b>...



but rather than the SET operator I want the AND, so it should only return the nodes that contain both values...

can someone advice me on how to tackle this?

I tried this but it didnt work


Thanks
HannaH
[ November 04, 2007: Message edited by: H Melua ]
 
Paul Clapham
Sheriff
Posts: 20987
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You want "the elements for which a is something and b is something else", right? So that'sIf you say out loud what you want, usually you will find the XPath is very similar to what you said.
[ November 04, 2007: Message edited by: Paul Clapham ]
 
H Melua
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks but no
I've tried this before and it didnt work , it says



could the problem be that Jaxon 1.1.1 does not yet support the AND operation?!!
[ November 05, 2007: Message edited by: H Melua ]
 
Paul Clapham
Sheriff
Posts: 20987
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have never heard of Jaxon, but if it doesn't support basic features of XPath then it's not worth using. I notice in the XPath Recommendation that they use "and" for "and". You could try that instead of "AND".
 
H Melua
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank youuuuuuuuu soooooooooooo much

ohhh life rescuer

dont I just love this place

(I turned on smilies so this post could have its full meaning - PC)
[ November 05, 2007: Message edited by: Paul Clapham ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic