I like the idea of a dom4j & JDOM & whatever specific implementation (in
their org.jaxen.dom4j or org.jaxen.jdom package) that sets up the navigator
and default Context & ContextSupport.
So the code could be like
JaXPath xpath = new JDOMXPath( expr );
List list = xpath.selectNodes( document );
or
JaXPath xpath = new Dom4jXPath( expr );
List list = xpath.selectNodes( document );
etc.
James
----- Original Message -----
From: "bob mcwhirter" <[EMAIL PROTECTED]>
To: "Brian Gebbie" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Saturday, July 28, 2001 5:22 AM
Subject: Re: [Jaxen] A simple way to get an XPath
>
> 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
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
_______________________________________________
Jaxen-interest mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jaxen-interest