You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2003/10/20 13:12:29 UTC
DO NOT REPLY [Bug 23933] New: -
XPath with predicate [1] returns multiple nodes
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23933>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23933
XPath with predicate [1] returns multiple nodes
Summary: XPath with predicate [1] returns multiple nodes
Product: XalanC
Version: 1.6
Platform: All
OS/Version: All
Status: NEW
Severity: Normal
Priority: Other
Component: XPathC
AssignedTo: xalan-dev@xml.apache.org
ReportedBy: tony@vordel.com
The following XPath
//descendant-or-self::Assertion[parent::Security][1]
When run over the following xml file
<Envelope>
<Security>
<Assertion id="First"/>
</Security>
<Security >
<Assertion id="Second"/>
</Security>
<Security >
<Assertion id="Third"/>
</Security>
</Envelope>
returns all three Assertion nodes. When the predicate [1] is changed to [2]
only the node with id="Second" is selected, ditto when [1] is replaced by [3]
only the third node is selected. Therefore there is an issue with the predicate
[1] being used. This is at odds with the java implementation's evaluation of
the same expression, which, as expected returns only one node when [1] is used.
Notes:
This issue is observed on Linux (kernel 2.4.7-10 and above), Win32(2000) and
Solaris (5.8).
The bug was seen in the last version of Xalan I was using (1.2) but is still
present in the current release (1.6). I am using the default xerces (2.3.0).
Here is a code snippet to clarify my usage.
XPathEvaluator theEvaluator;
XalanSourceTreeDOMSupport theSupport;
const XObjectPtr dataObj = theEvaluator.evaluate(
theSupport,
theContext,
theXPATH.c_str(),
theResolver);
if (dataObj->getType() != XObject::eTypeNodeSet)
{//Error handling ommitted for clarity...}
return new MutableNodeRefList((const NodeRefList)dataObj->nodeset());
The context node is the document node. The prefix resolver has been extended in
my impl but since there are no namespaces in my simplified example this should
not be an issue.
If you need any more information then I will be happy to oblige.
Tony