Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-8843] XPath handling differs between Darwin Foundation and corelibs-foundation #3629

Open
kevints mannequin opened this issue Sep 25, 2018 · 0 comments
Open

[SR-8843] XPath handling differs between Darwin Foundation and corelibs-foundation #3629

kevints mannequin opened this issue Sep 25, 2018 · 0 comments

Comments

@kevints
Copy link
Mannequin

kevints mannequin commented Sep 25, 2018

Previous ID SR-8843
Radar None
Original Reporter @kevints
Type Bug

Attachment: Download

Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Bug
Assignee None
Priority Medium

md5: 201503af900cd7a29fb5e6d6bd87e070

Issue Description:

The behavior of an XPath expression on an XMLDocument is different between the Darwin version of Foundation and the Linux version. On Darwin Foundation the query appears to be rooted at the document node while in corelibs-foundation the query appears to be rooted at the root element node. I suspect the divergence may have been introduced in commit 136108621e680b2167a96f0b9e901e71db5ddc25:

See attached Playground.

On Xcode 10.0 I get the following:

Expected: 2 elements
Evaluating XPath expression on document: ./root/bug/@number
Result: 2 nodes
Node 0: number="1"
Node 1: number="2"
---
Evaluating XPath expression on document: /root/bug/@number
Result: 2 nodes
Node 0: number="1"
Node 1: number="2"
---
Evaluating XPath expression on root element: ./bug/@number
Result: 2 nodes
Node 0: number="1"
Node 1: number="2"
Evaluating XPath expression on root element: /root/bug/@number
Result: 2 nodes
Node 0: number="1"
Node 1: number="2"

On Ubuntu 16.04 (Swift 4.2-RELEASE) I get this output:

Expected: 2 elements
Evaluating XPath expression on document: ./root/bug/@number
Result: 0 nodes
---
Evaluating XPath expression on document: /root/bug/@number
Result: 2 nodes
Node 0:  number="1"
Node 1:  number="2"
---
Evaluating XPath expression on root element: ./bug/@number
Result: 2 nodes
Node 0:  number="1"
Node 1:  number="2"
Evaluating XPath expression on root element: /root/bug/@number
Result: 2 nodes
Node 0:  number="1"
Node 1:  number="2"
@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

0 participants