[ 
http://issues.apache.org/jira/browse/XALANJ-1547?page=comments#action_57799 ]
     
Martin Thomson commented on XALANJ-1547:
----------------------------------------

This is a fairly major concern for me - given that the XPath expression may be 
taken from a context other than the document in question, the prefixes do not 
necessarily have to match those used in the document.  Hence the reason for 
implementing XPathNSResolver:

        final Map<String, String> prefixes;
...
        XPathNSResolver resolver = new XPathNSResolver() {
                public String lookupNamespaceURI(String prefix)
                {
                    return prefixes.get(prefix);
                }
            };
        XPathResult result = (XPathResult)evaluator.evaluate(expr, element, 
resolver,
            XPathResult.FIRST_ORDERED_NODE_TYPE, null);


> About a class cast in XPathEvaluatorImpl.java
> ---------------------------------------------
>
>          Key: XALANJ-1547
>          URL: http://issues.apache.org/jira/browse/XALANJ-1547
>      Project: XalanJ2
>         Type: Bug
>   Components: XPath
>     Versions: 2.5
>  Environment: Operating System: Other
> Platform: All
>     Reporter: Satoshi Hada
>     Assignee: Xalan Developers Mailing List

>
> XPathEvaluatorImpl.java, line 204:
> In the createExpression method, the "resolver" instance is 
> casted to PrefixResolver. This causes a problem. 
> When I use my own implementation of the XPathNSResolver interface, 
> a ClassCastException is thrown.
> The "resolver" instance should be wrapped by a class implementing 
> the PrefixResolver interface.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


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

Reply via email to