dynamically parse xpath predicates

Discussion in 'Java' started by Juuno, Apr 26, 2009.

  1. Juuno

    Juuno New Member

    Joined:
    Feb 3, 2009
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    0
    XPathExpression expr = xpath.compile("//catalog//book[title='Midnight Rain']//author//text()");

    In the above code, the result will be the author node value in which the tile is 'Midnight Rain', right? But I would like to parse that value dynamically from user input instead of constant value. Like, for example: XPathExpression expr = xpath.compile("//catalog//book[title=input-got-from-user]//author//text()");

    How can i do this? Thanks in advance.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice