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-5889] [XMLNode] nodes(forXPath:) returns inappropriate empty array in some cases on Linux #3806

Open
YOCKOW opened this issue Sep 15, 2017 · 1 comment

Comments

@YOCKOW
Copy link
Collaborator

YOCKOW commented Sep 15, 2017

Previous ID SR-5889
Radar None
Original Reporter @YOCKOW
Type Bug
Environment
  • OS: Ubuntu 16.04

  • Swift: 3.1.1 / 4.0-dev

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

md5: 3c26eaabe35a2aae7cc091e4f4284901

Issue Description:

`nodes(forXPath: )` returns empty array when tag name is specified even if there should be some nodes.

[Sample Code]

import Foundation

let s = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!DOCTYPE html>\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>My Title</title></head><body><div>My Body.</div></body></html>"

let xml = try! XMLDocument(xmlString:s, options:[])

let nodes1 = try! xml.nodes(forXPath:"/*/*[2]")
let nodes2 = try! xml.nodes(forXPath:"/*/body")
let nodes3 = try! xml.nodes(forXPath:"//body")

Although `nodes1`, `nodes2`, and `nodes3` should be the same, `nodes2` and `nodes3` are empty on Linux. (Swift 3.1.1, Swift 4.0-dev)

There's no problem on macOS.

@belkadan
Copy link

@phausler, who owns the corelibs XML stuff?

@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

2 participants