Title: A simple way to get an XPath

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

Reply via email to