[
http://issues.apache.org/jira/browse/XALANJ-2319?page=comments#action_12445967
]
Brian Minchau commented on XALANJ-2319:
---------------------------------------
If in the Java code you add this before creating the factory:
System.setProperty("javax.xml.xpath.XPathFactory:http://java.sun.com/jaxp/xpath/dom","org.apache.xpath.jaxp.XPathFactoryImpl");
or the equivalent as a JVM argument, then one always gets the class:
org.apache.xpath.jaxp.XPathImpl
which is the class supported by Apache Xalan.
The other class, com.sun.org.apache.xpath.internal.jaxp.XPathImpl is SUN's
repackaging of Xalan into their JRE and we can't help you much there. Also the
class named org.apache.xpath.jaxp.XPathImpl with IBM J9 1.5.0 VM is also
probably a repackaging of Xalan's code into their JRE. I have to admit that
either company may do more than repackage, they might improve it .... hard to
say.
In any case it is likely that all three versions (Apache, SUN, IBM) probably
have the same bug anyway. I'm afraid that I don't have the energy to look
further into this one at this time, and I can't promise about the future
(especially the limited future between now and the 2.7.1 release which is in a
few weeks), so if you want this one fixed and you happen to think you know how
it can be fixed please propose a patch.
Running a patch through the regression tests is not as difficult as actually
finding the fix for the the bug.
Regards,
Brian Minchau
> Descendant axis sometimes includes the context node
> ---------------------------------------------------
>
> Key: XALANJ-2319
> URL: http://issues.apache.org/jira/browse/XALANJ-2319
> Project: XalanJ2
> Issue Type: Bug
> Components: parse-or-compile
> Affects Versions: 2.7
> Reporter: Igor Peshansky
> Assigned To: Brian Minchau
>
> The following code:
> import javax.xml.parsers.DocumentBuilderFactory;
> import javax.xml.xpath.XPath;
> import javax.xml.xpath.XPathConstants;
> import javax.xml.xpath.XPathFactory;
> import org.w3c.dom.DOMImplementation;
> import org.w3c.dom.Document;
> import org.w3c.dom.Element;
> public class Y {
> public static void main(String[] stringArr) throws Exception {
> DOMImplementation domImpl =
> DocumentBuilderFactory.newInstance().newDocumentBuilder().getDOMImplementation();
> Document document = domImpl.createDocument(null, "foo", null);
> Element element = document.getDocumentElement();
> element.appendChild(document.createElement("bar"));
> XPath xpath = XPathFactory.newInstance().newXPath();
> String result = (String)
> xpath.evaluate("name(./descendant::*)", element, XPathConstants.STRING);
> System.out.println(result);
> }
> }
> prints "foo", whereas it should have printed "bar". Changing the XPath
> expression from "name(./descendant::*)" to
> "name(self::node()/./descendant::*)" makes Xalan produce the correct result,
> but "name(self::node()/descendant::*)" still exhibits the incorrect behavior.
> A bit of debugging shows that when DescendantIterator is created, the
> constructor sets the axis to DESCENDANTORSELF, because the first step is a
> FROM_SELF (even though the subsequent steps are not supposed to return the
> self node).
--
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]