As an example, this SegFaults:

import Foundation

class ParserDelegate: NSObject, XMLParserDelegate {
    func parserDidStartDocument(_ parser: XMLParser) {
        print("Starting document")
    }

    func parser(_ parser: XMLParser, didStartElement elementName: String, 
namespaceURI: String?, qualifiedName qName: String?, attributes attributeDict: 
[String : String] = [:]) {
        print("*** \(elementName)")
    }
}

let xml = "<root><title name=\"test\">George</title></root>"
let data = xml.data(using: .utf8)!
let xmlParser = XMLParser(data: data)
xmlParser.delegate = ParserDelegate()
xmlParser.parse()

> On 5 Sep 2017, at 9:01 AM, Georgios Moschovitis 
> <george.moschovi...@icloud.com> wrote:
> 
> Hi,
> 
> I would like to parse an RSS feed using Swift 3.1 on Linux.
> I tried to use Foundations’s XML but I only managed to get segmentation 
> faults. 
> Is this supposed to work on Linux? I have only seen examples on iOS.
> 
> Apart from that a quick search didn’t reveal any useful XML parsing library 
> compatible with Linux.
> 
> Any suggestions?
> 
> -g.

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to