[ http://issues.apache.org/jira/browse/XALANJ-2138?page=all ]
Brian Minchau updated XALANJ-2138:
----------------------------------
Fix Version: 2.7
> String literals passed to XPathAPI result in XPathException
> -----------------------------------------------------------
>
> Key: XALANJ-2138
> URL: http://issues.apache.org/jira/browse/XALANJ-2138
> Project: XalanJ2
> Type: Bug
> Components: XPath-API
> Versions: 2.6
> Environment: WinXP sp2 Prof, J2SDK1.4.2_08, Eclipse 3.1Mx, Xalan 2.6.0
> Reporter: Ian Sollars
> Fix For: 2.7
>
> The following is a valid XPath expression:
> 'test'
> However, code such as the following:
> Document d = XMLUtils.newDocument(new
> StringInputStream("<xml></xml>"));
>
> System.out.println(
> XPathAPI.selectSingleNode(d.getDocumentElement(), "'test'") );
> produces the following stack trace:
> org.apache.xpath.XPathException: Can not convert #STRING to a NodeList!
> at org.apache.xpath.objects.XObject.error(XObject.java:741)
> at org.apache.xpath.objects.XObject.nodeset(XObject.java:471)
> at org.apache.xpath.XPathAPI.selectNodeIterator(XPathAPI.java:175)
> at org.apache.xpath.XPathAPI.selectSingleNode(XPathAPI.java:133)
> at org.apache.xpath.XPathAPI.selectSingleNode(XPathAPI.java:113)
> [jUnit & Eclipse lines elided]
> My suggestion is to change XPathAPI.selectNodeIterator (line 166 in 2.6.0) to
> test getType() against CLASS_STRING and CLASS_NUMBER(?), and return
> contextNode.getOwnerDocument().createTextNode(list.str()) if equal to one of
> those two.
> Thanks a lot,
> - Ian
--
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
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]