kgw Posted October 9, 2006 Share Posted October 9, 2006 Hi,Is there any XPath parser written in java?What I want is: given an XPath string, let say /a/b[pred01]/axes::*/... (pred01 can be anything)it would return the steps of the XPath, ex: a, b[pred01], axes, ...or something more detailThanks,kgw Link to comment Share on other sites More sharing options...
boen_robot Posted October 9, 2006 Share Posted October 9, 2006 Xercec2-j is an XML parser for JAVA. There's also JAXP from Sun themselves. This few pages article discusses different JAVA parsers. It's probably good to read as it discusses good pointers such as the Performance of each one. Link to comment Share on other sites More sharing options...
kgw Posted October 10, 2006 Author Share Posted October 10, 2006 Hi boen_robot,Thanks for the article, but actually it's not what I am looking for. I am not looking for XML parser (parser to parse XML document), but rather XPath parser (to parse XPath). But I do not want the XPath parser to evaluate the XPath expression and return me XML nodes (I don't want the XPath parser to query the XML document). Rather, I want the XPath parser to return me an array or a list or tree or anything where I can go step by step. I am looking for something like this:xpath = XPathParser.parse("/a/b[P and Q]/following::*");xpath.step(1) will return axis = child, NameTest = axpath.step(2) will return axis = child, NameTest = b, predicate = P and Qpredicate can further be divided into predicate.part(1) = P, predicate.part(2) = Q, predicate.boolean() = andxpath.step(3) will return axis = following, NameTest = *Thanks,kgw Link to comment Share on other sites More sharing options...
boen_robot Posted October 10, 2006 Share Posted October 10, 2006 I don't think there is such a thing. Simply because it's not something that needed. You could construct something like this yourself by using regular expressions, but I feel it's not worth the effort. Link to comment Share on other sites More sharing options...
kgw Posted October 12, 2006 Author Share Posted October 12, 2006 Hi,I post the question to other mailing list and they give me the following xpath/xquery parser. They are W3C recommendation.http://www.w3.org/2005/qt-applets/xpathApplet.htmlhttp://www.w3.org/2005/qt-applets/xqueryApplet.htmlRegards,kgw Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now