Looking for a java xpath parser

Discussion in 'XML' started by Ketan, Aug 19, 2004.

  1. Ketan

    Ketan Guest

    Hello,

    I am looking for a java-based xpath parser, that will enable me parse
    a string containing an xpath expression into steps, predicates,
    conditions etc.

    sample expressions: a/b/c, a/b[@name='123'][4]/c[@name='ddd']
    etc.

    I have looked at a couple and didn't really find what I wanted.. Some
    did not have methods to get the info I was looking for, one did not
    support the level of indexing I need...

    Any pointers would be greatly appeciated..

    Thanks in advance.

    -K
     
    Ketan, Aug 19, 2004
    #1
    1. Advertising

  2. Ketan wrote:
    > Hello,
    >
    > I am looking for a java-based xpath parser, that will enable me parse
    > a string containing an xpath expression into steps, predicates,
    > conditions etc.
    >
    > sample expressions: a/b/c, a/b[@name='123'][4]/c[@name='ddd']
    > etc.
    >
    > I have looked at a couple and didn't really find what I wanted.. Some
    > did not have methods to get the info I was looking for, one did not
    > support the level of indexing I need...
    >
    > Any pointers would be greatly appeciated..
    >
    > Thanks in advance.
    >


    Have you tried SAXPath? http://saxpath.sourceforge.net/
    Its now part of Jaxen: http://jaxen.org/

    Peter
     
    Peter Votruba, Aug 23, 2004
    #2
    1. Advertising

  3. Ketan

    GIMME Guest

    JDOM works for me ....

    Since that should have been what you looked at first or second - what
    is there not to like?


    <%@ page import="org.jdom.xpath.*"%>
    <%@ page import="org.jdom.Element"%>

    XPath xpath = XPath.newInstance("//input[@name='manager_login']");
    List ManagerList = null;
    if ( null != xpath ) {
    ManagerList = xpath.selectNodes(new Document(myjdom));
    }


    (Ketan) wrote in message news:<>...
    >
    > I have looked at a couple and didn't really find what I wanted.. Some
    > did not have methods to get the info I was looking for, one did not
    > support the level of indexing I need...
    >
     
    GIMME, Aug 23, 2004
    #3
  4. Thanks for the pointer to JDOM. However, I don't want to actually
    address into an XML doc, I want to be able to parse the XPATH string and
    break it apart into it's individual parts and then I need to be able to
    accss those individual expresions, steps and predicates. A number of
    parsers to what you are illustrating; however, that's not my
    application.

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Ketan Deshpande, Aug 27, 2004
    #4
  5. Peter,

    Thanks for the pointer. I am looking at using Jaxen.

    -K

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Ketan Deshpande, Aug 27, 2004
    #5
  6. Ketan

    GIMME Guest

    Try Googling "Xpath Parser".

    I came up with this ...

    http://groups.google.com/groups?hl=...xpath+parser&hl=en&lr=&ie=UTF-8&start=20&sa=N

    (http://www.acooke.org/jara/org-acooke/index.html looks like you have
    to
    ask via email for the source)


    Ketan Deshpande <> wrote in message news:<412ec2d4$0$14503$>...
    > Thanks for the pointer to JDOM. However, I don't want to actually
    > address into an XML doc, I want to be able to parse the XPATH string and
    > break it apart into it's individual parts and then I need to be able to
    > accss those individual expresions, steps and predicates. A number of
    > parsers to what you are illustrating; however, that's not my
    > application.
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
     
    GIMME, Aug 27, 2004
    #6
    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,996
    jan V
    Jul 29, 2005
  2. Alastair Cameron
    Replies:
    1
    Views:
    7,445
    SQL Server Development Team [MSFT]
    Jul 8, 2003
  3. Anna
    Replies:
    0
    Views:
    542
  4. goog
    Replies:
    0
    Views:
    518
  5. Tjerk Wolterink

    XPath: efficiency in xpath expressions

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

Share This Page