----- Original Message ----- From: "Son Truong" <[EMAIL PROTECTED]> > Can i create XPath expression from xpath string? If yes, how can i do it? > > > e.g. in the org.jaxen.expr package, if you can get hold of an XPath object > > and get the root expression. > > > > Expr expr = XPath.getRootExpr(); > > > > How can i get hold of the XPath object? Here do you mean org.jaxen.expr.XPath > object?
Yes. Actually if you look in the org.jaxen.JaXPath class, the constructor demonstrates how to parse a String and create an org.jaxen.expr.XPath. I've just patched org.jaxen.JaXPath (and so BaseXPath and all the model specific XPath implementations) should now have the getRootExpr() method on them now. > > Then walk the expression or call toString() to get a textual representation > > of the expression tree objects. Its mostly gonna be LocationPath objects > > with Prediactes and stuff. Then through a few different XPath expressions > > you should get a feel for what the Expr object hierrarchy looks like. > > > > (Though documentation would be better ;-) > > > > James > > If i can get hold of an XPath object and get the root expression, then how can i > walk the expression? I'd surf the javadoc for the org.jaxen.expr interfaces. If you convert the Expr to a string via toString() you should get a feel for the hierarchy. e.g. you could cast to a PathExpr, get the LocationPath, iterate through the Steps, look at the PredicateSet etc. James _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com _______________________________________________ Jaxen-interest mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jaxen-interest