You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-users@xml.apache.org by Øyvind Vestavik <Oy...@idi.ntnu.no> on 2002/02/18 12:29:37 UTC
newbie xpath question
Could someone give me a tip as to how to iclude AND OR and NOT
in a xpath querystring testing on different elements in a document?
Or maybe pass on a reference to where to look for info??
My actual problem is:
I have a sample xml doc in my Xindice.
<profile>
<username>Jeff</username>
<pwd>JeffsPwd</pwd>
......
</profile>
I want to check login for registered user. If the user enters a valid
combination of¨username and password (eg there exists a profile for the
given combination of username and pwd) the users will be logged in.
To look for profiles matches I try to use something like
String xpath ="//profile/username[text='Jeff']";
which finds documents where the username if 'Jeff', but how do I find
documents where the username is 'Jeff' AND the pwd is 'JeffsPwd"????
I have tried with
String
xpath="//profile/username[text='Jeff']&&//profile/pwd[text='JeffsPwd]=";
but this doesn't return the test document
Any hints would be appreciated.
Øyvind
Re: newbie xpath question
Posted by Øyvind Vestavik <Oy...@idi.ntnu.no>.
Thanks Krzysztof. That did the trick :-)
Øyvind Vestavik
Øvre Møllenberggt 44b
7014 Trondheim
oyvindve@idi.ntnu.no
41422911
Re: newbie xpath question
Posted by Krzysztof Kowalczykiewicz <kr...@cs.put.poznan.pl>.
Hi!
//profile[username='Jeff' and pwd='JeffsPwd']
should work
Krzysztof Kowalczykiewicz
----- Original Message -----
From: "Øyvind Vestavik" <Oy...@idi.ntnu.no>
To: <xi...@xml.apache.org>
Cc: "Marius Mikalsen" <Ma...@idi.ntnu.no>
Sent: Monday, February 18, 2002 12:29 PM
Subject: newbie xpath question
Could someone give me a tip as to how to iclude AND OR and NOT
in a xpath querystring testing on different elements in a document?
Or maybe pass on a reference to where to look for info??
My actual problem is:
I have a sample xml doc in my Xindice.
<profile>
<username>Jeff</username>
<pwd>JeffsPwd</pwd>
......
</profile>
I want to check login for registered user. If the user enters a valid
combination of¨username and password (eg there exists a profile for the
given combination of username and pwd) the users will be logged in.
To look for profiles matches I try to use something like
String xpath ="//profile/username[text='Jeff']";
which finds documents where the username if 'Jeff', but how do I find
documents where the username is 'Jeff' AND the pwd is 'JeffsPwd"????
I have tried with
String
xpath="//profile/username[text='Jeff']&&//profile/pwd[text='JeffsPwd]=";
but this doesn't return the test document
Any hints would be appreciated.
Øyvind