Looking for a java xpath parser

K

Ketan

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
 
P

Peter Votruba

Ketan said:
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
 
G

GIMME

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));
}
 
K

Ketan Deshpande

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,830
Latest member
HeleneMull

Latest Threads

Top