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. Advertising

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. Marvin_123456

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

    Marvin_123456, Jul 29, 2005, in forum: Java
    Replies:
    4
    Views:
    1,964
    jan V
    Jul 29, 2005
  2. Alastair Cameron
    Replies:
    1
    Views:
    7,391
    SQL Server Development Team [MSFT]
    Jul 8, 2003
  3. Anna
    Replies:
    0
    Views:
    519
  4. goog
    Replies:
    0
    Views:
    504
  5. Tjerk Wolterink

    XPath: efficiency in xpath expressions

    Tjerk Wolterink, Nov 13, 2004, in forum: XML
    Replies:
    1
    Views:
    1,622
    Richard Tobin
    Nov 13, 2004
Loading...

Share This Page