Open
Description
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.