Results 1 to 6 of 6

Thread: XML: Query with "or" or "and" (Solved)

  1. #1

    Thread Starter
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192

    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

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    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.

  3. #3

    Thread Starter
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192
    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

  4. #4

    Thread Starter
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192
    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

  5. #5

    Thread Starter
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192
    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

  6. #6
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    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
  •  



Click Here to Expand Forum to Full Width