Yes, you're right.  It is more cumbersome, right now.

That will certainly be alleviated before we reach a final 1.0
release.  (Plus, I intend to rework werken.xpath so that code
that uses the werken.xpath classes will still function, with
Jaxen in the background.)

We may end up with something like:

        JaXPath xpath = new XPath( expr );

        List list = xpath.selectNodes( element, new JdomNavigator() );

Or, even:

        JaXPath xpath = new JdomJaXPath( expr );

        List list = xpath.selectNodes( element );

Though, the try/catch blocks around construction will still probably be
required, to notify of syntax or other errors.  

werken.xpath was deficient in that regard.

Please, though, keep checking the Jaxen docs/distribution, and provide
whatever feedback you think would make for a better API.  werken.xpath
is definitely destined to be deprecated, so help us make Jaxen even
better

        -bob


On Fri, 27 Jul 2001, Brian Gebbie wrote:

> I was using werken.xpath where all I had to do (I am using jdom):
> 
> XPath xpath = new XPath(expr);
> List list = xpath.applyTo(element);
> 
> And now it seems I have to write a lot of code to do the above with jaxen
> and I was wondering if there is an easier way to do this e.g.:
> 
>         ContextSupport cs = new ContextSupport(
>                                             null,
>  
> XPathFunctionContext.getInstance(),
>                                             null,
>                                             new JdomNavigator() );
>         Context context = new Context(cs);
>         context.setNodeSet(Collections.singletonList(element));
>         JaXPath xpath = null;
>         try
>         {
>             xpath = new JaXPath(select);
>         }
>         catch (SAXPathException e)
>         {
>             System.err.println(e.getMessage());
>         }
>         List list = xpath.select(context);
> 
> -brian
> 


_______________________________________________
Jaxen-interest mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jaxen-interest

Reply via email to