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 fr
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
https://lists.s
> 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 you.___
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 AM,
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 TUNG via swift-users > <
>
> Foundation (NS)XML parsing is a little buggy and incomplete, check out
> github.com/kelvin13/swiftxml for a pure swift implementation
Your implementation seems to be Swift4 only?
-g.
PS: Also, I am a bit put-off by some C/C++ coding conventions (e.g. snake_case)
>
>> On Sep 5, 2017, at
Foundation (NS)XML parsing is a little buggy and incomplete, check out
github.com/kelvin13/swiftxml for a pure swift implementation
> On Sep 5, 2017, at 1:01 AM, Georgios Moschovitis via swift-users
> wrote:
>
> Hi,
>
> I would like to parse an RSS feed using Swift 3.1 on Linux.
> I tried to
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
>
> import Foundation
>
> clas
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 = sel
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?, q
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
compat
12 matches
Mail list logo