You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@abdera.apache.org by Kiran Subbaraman <ki...@yahoo.com> on 2007/10/12 15:43:41 UTC

Jaxen XPath alternative?

Can I use any other classlibrary, instead of Jaxen, for XPath support?
My observations:
I should add this param: "org.apache.abdera.xpath.XPath" with the value:
toMyXPathImpl, into my web.xml or anywhere else?
The default value is "org.apache.abdera.parser.stax.FOMXPath"
I got this information from:
http://svn.apache.org/repos/asf/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/Constants.java

Am I on the right path? Thank you for your help
Kiran

-- 
View this message in context: http://www.nabble.com/Jaxen-XPath-alternative--tf4613728.html#a13175511
Sent from the abdera-user mailing list archive at Nabble.com.


Re: Jaxen XPath alternative?

Posted by James M Snell <ja...@gmail.com>.
As with all of the core interfaces, XPath is designed to theoretically
allow the underlying implementation to be replaced.  I say theoretically
because in many cases it would be exceedingly difficult to actually do
such a replacement.  The XPath component happens to be one of the easier
bits.  We currently use Jaxen for two reasons: one, that's what Axiom
used and two, Jaxen provides a way of evaluating the xpath by navigating
through the Axiom/FOM object structure; this means that the xpath
evaluation works well with the parser implementation.  However, if you
did want to provide an alternative XPath, all you need to do is
implement the XPath interface then:

  a) launch the jvm with the option
       -Dorg.apache.abdera.xpath.XPath=myImpl

  *OR*

  b) add a file called abdera.properties to your classpath and add
      org.apache.abdera.xpath.XPath=myImpl

  *OR*

  c) add a file to the classpath classpath at:
     /META-INF/services/org.apache.abdera.xpath.XPath where the
     content of the file is the classname or your impl.

Each of these options provide various benefits.  Option A is often good
for debugging if you want to test a new implementation without having to
change the configuration.  Option B is good if you have multiple
implementations available in your classpath.  Option C is the easiest
because you can usually add the file to the jar and simply drop the jar
into your classpath to automatically register it.

- James

Kiran Subbaraman wrote:
> Can I use any other classlibrary, instead of Jaxen, for XPath support?
> My observations:
> I should add this param: "org.apache.abdera.xpath.XPath" with the value:
> toMyXPathImpl, into my web.xml or anywhere else?
> The default value is "org.apache.abdera.parser.stax.FOMXPath"
> I got this information from:
> http://svn.apache.org/repos/asf/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/Constants.java
> 
> Am I on the right path? Thank you for your help
> Kiran
>