|
-
May 28th, 2003, 12:29 AM
#1
Thread Starter
Frenzied Member
XML: Query with "or" or "and" (Solved)
Hello there, I am new using XML and XPath as a query language...
I wonder if it is possible to make a query like this:
XMLquery = "/bookstore/books/title[../author='Jules Verne' AND ../publisher='CG Publish']"
I know it is wrong since I cannot execute the query.. But how can I do this?
I had to iterate through the results using an XPathNodeIterator and check if they would fit the condition... But isn't there a more efficient way? I thought it could be like:
XMLquery = "/bookstore/books/title[../author='Jules Verne'] AND [../publisher='CG Publish']"
But it did not want either... I searched for an example that had two conditions and I found none... Could you please help me?
Thanks in advance!
Last edited by Tec-Nico; May 28th, 2003 at 11:38 AM.
We miss you, friend...  Rest in Peace, we will take care of the rest of it.
[vbcode]
On Error Me.Fault = False
[/vbcode]
- Silence is the human way to share ignorance
Tec-Nico
-
May 28th, 2003, 04:00 AM
#2
What about
XMLquery = "/bookstore/books/title[../author='Jules Verne'][../publisher='CG Publish']"
assuming that the ../* things are correct.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
May 28th, 2003, 10:23 AM
#3
Thread Starter
Frenzied Member
Thanks, Corned Bee, let me try it!
We miss you, friend...  Rest in Peace, we will take care of the rest of it.
[vbcode]
On Error Me.Fault = False
[/vbcode]
- Silence is the human way to share ignorance
Tec-Nico
-
May 28th, 2003, 10:38 AM
#4
Thread Starter
Frenzied Member
Hmmm.. Is that for the OR or for the AND, Corned Bee?
We miss you, friend...  Rest in Peace, we will take care of the rest of it.
[vbcode]
On Error Me.Fault = False
[/vbcode]
- Silence is the human way to share ignorance
Tec-Nico
-
May 28th, 2003, 11:37 AM
#5
Thread Starter
Frenzied Member
I don't know why this was not working before... But on the console this works:
XMLquery = "/bookstore/books/title[../author='Jules Verne' and ../publisher='CG Publish']"
XMLquery = "/bookstore/books/title[../author='Jules Verne' or ../publisher='CG Publish']"
I think I had a trouble because I was building the query by code... Thanks anyway...
We miss you, friend...  Rest in Peace, we will take care of the rest of it.
[vbcode]
On Error Me.Fault = False
[/vbcode]
- Silence is the human way to share ignorance
Tec-Nico
-
May 29th, 2003, 01:01 PM
#6
It would have been for the AND, but apparently you don't have the problem anymore
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|