XPath Question

Discussion in 'XML' started by Chris, Aug 5, 2003.

  1. Chris

    Chris Guest

    Assuming the following XML:

    <poll>
    <title>Test Poll</title>
    <date>07/30/2003</date>
    <instructions>Please respond to the following poll:</instructions>
    <questions>
    <question>
    <label>What is your choice?</label>
    <choices>
    <choice>Choice 1</choice>
    <choice>Choice 2</choice>
    <choice>Choice 3</choice>
    </choices>
    </question>
    </questions>
    </poll>

    .... I'd like to use XPath to find the "choice" element that has a
    particular value, for example "Choice 2."

    What is the syntax? I thought it would be something like:

    //choices[choice='Choice 2']/choice

    .... but that doesn't seem to do the trick. Any ideas?
     
    Chris, Aug 5, 2003
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark Fox

    XML XPath Question

    Mark Fox, Nov 15, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    972
    Bret Mulvey [MS]
    Nov 15, 2003
  2. DN

    XPath AddSort Question

    DN, Mar 5, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    1,496
    Teemu Keiski
    Mar 6, 2004
  3. Marvin_123456

    "Memory leak" in javax.xml.xpath.XPath

    Marvin_123456, Jul 29, 2005, in forum: Java
    Replies:
    4
    Views:
    2,297
    jan V
    Jul 29, 2005
  4. Alastair Cameron
    Replies:
    1
    Views:
    8,160
    SQL Server Development Team [MSFT]
    Jul 8, 2003
  5. Anna
    Replies:
    0
    Views:
    761
  6. goog
    Replies:
    0
    Views:
    681
  7. Tjerk Wolterink

    XPath: efficiency in xpath expressions

    Tjerk Wolterink, Nov 13, 2004, in forum: XML
    Replies:
    1
    Views:
    2,102
    Richard Tobin
    Nov 13, 2004
  8. Replies:
    4
    Views:
    1,006
    Joseph Kesselman
    Aug 10, 2006
Loading...