Hi,

> According to the W3C recommendation, an XPahEvaluator
The XPath module is a working group Note, not a W3C recommendation [1].

In general Xerces will only support XPath module if Xalan implementation is
in the classpath.
Xerced does not support direct casting, but as described in the "Mixed
implementations" [2] section the implementation can be obtained using
Node.getFeature(..) method.

There are might be a bug in Xerces though, I believe it should only return
true for Node.isSupported(feature, version) with "+XPath" not "XPath"
feature since direct casting is not supported [2]:
[[
if a plus sign "+" is prepended to any feature name, implementations are
considered in which the specified feature may not be directly castable but
would require discovery through DOMImplementation.getFeature(feature,
version) and Node.getFeature(feature, version).
]]



[1] http://www.w3.org/TR/2004/NOTE-DOM-Level-3-XPath-20040226/
[2]
http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#DOMFeatures

Thank you,
--
Elena Litani / IBM Toronto

Fr�d�ric Laurent <[EMAIL PROTECTED]> wrote on 05/03/2004 04:05:26 PM:

> Hello
>
> According to the W3C recommendation, an XPahEvaluator object could be
> obtained by a cast of a Document implementation, if the DOM
> implementation supports the DOM 3 XPath feature.
>
> My DOM implementation is xerces 2.6.2 and at the question
> impl.hasFeature("XPath", "3.0")
>
> the response is true.
>
> Then, the following code should be ok :
>
> doc =
>
DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(inputsource);

>
> XPathEvaluator evaluator = (XPathEvaluator) doc;
>
> XPathResult result = (XPathResult) evaluator.evaluate(xpath, doc,...
>
> right ?
>
> But I've got
> [java] java.lang.ClassCastException
> [java] at test.XPathW3C.evalXpath(Unknown Source)
> [java] at test.XPathW3C.main(Unknown Source)
> [java] Exception in thread "main"
> [java] Java Result: 1
>
> while
>
> XPathEvaluator evaluator = new
>                org.apache.xpath.domapi.XPathEvaluatorImpl(doc);
>
> works fine.
>
> So my question is : this error is the consequence of the immature
> implementation of DOM 3 XPath recommendation ? and will it work as
> described in my first example ?
>
> thanks in advance.
>
> regards
>
> --
> XPath free testing software :  http://www.opikanoba.org/lantern/
> Fr�d�ric Laurent                        http://www.opikanoba.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to