Thank you, I wasn’t aware of XMLDocument.
I managed to get XMLParser to work for my use case though…
-g.
___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users
On 2017-09-05 06:01:55 +, Georgios Moschovitis via swift-users said:
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
FWIW, I also prefer snake_case, but camelCase is unfortunately the standard
convention in Swift so I use that.
Also, I avoid using libraries that don’t follow standard conventions.
-g.
___
swift-users mailing list
swift-users@swift.org
> XMLParser’s delegate is unowned, so it’s being deallocated when you exit the
> current scope. Hold on to it with a strong reference:
>
> let delegate = ParserDelegate()
> xmlParser.delegate = delegate
Wow!
Need to brush-up my understanding of Swift ‘pointers’
Thank
The CI builds on Swift 4, i believe it should work fine on master too but
it’s not tested there. Also I don’t think snake_case is C++ convention,
i’ve seen both. I use snake_case because camelCase looks too similar to
UpperCamelCase which is reserved for type names.
On Tue, Sep 5, 2017 at 3:43
Saagar Jha
> On Sep 5, 2017, at 01:19, Georgios Moschovitis via swift-users
> wrote:
>
> Indeed it works, but I don’t get it.
> What’s the difference?
>
> -g.
>
> PS: Btw, my original code was giving `seg-fault: 11` even on macOS.
>
>> On 5 Sep 2017, at 10:53 AM, CK
Indeed it works, but I don’t get it.
What’s the difference?
-g.
PS: Btw, my original code was giving `seg-fault: 11` even on macOS.
> On 5 Sep 2017, at 10:53 AM, CK TUNG via swift-users
> wrote:
>
> This revised code, as below, works without segmentation fault
>
>
This revised code, as below, works without segmentation fault
import Foundation
class ParserDelegate: NSObject, XMLParserDelegate {
func startParsing(_ xml:String) {
let data = xml.data(using: .utf8)!
let xmlParser = XMLParser(data: data)
xmlParser.delegate =
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?,
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
10 matches
Mail list logo