Questions tagged [swxmlhash]

SWXMLHash is a third-party XML parser for swift

SWXMLHash is a third-party XML parser for Swift that wraps NSXMLParser.

Links:

https://github.com/drmohundro/swxmlhash

Related tags:

46 questions
38
votes
1 answer

Implementing a custom Decoder in Swift 4

I'd like to decode an XML document using the new Decodable protocol introduced in Swift 4, however, there doesn't seem to be an existing implementation for an XML decoder that conforms to the Decoder protocol. My plan was to use the SWXMLHash…
Toni Sučić
  • 1,329
  • 1
  • 13
  • 20
4
votes
1 answer

Iterating Through an XML file using SWXMLHash for Swift

Here is my Code block for this, var a = 0; let task = NSURLSession.sharedSession().dataTaskWithRequest(request) { data, response, error in if error != nil { println("error=\(error)") return } responseString =…
Zinathene
  • 41
  • 1
  • 3
3
votes
2 answers

Getting error in parsing xml using SWXMLHash with Alamofire

I am using pods with Swift 4 pod 'SWXMLHash', '~> 4.0.0' pod 'Alamofire', '~> 4.5' When I am parsing XML with below code, getting the error: Type 'XMLIndexer' does not conform to protocol…
Asif Raza
  • 836
  • 12
  • 29
3
votes
3 answers

How to send a request with alamofire with xml Body

I installed Alamofire in my project and now here is what I have done. I installed postman and I put my url and inside body a xml object and I got my result. Here is a picture of what I exactly have done with postman How can I now use Alamofire or…
mike vorisis
  • 2,786
  • 6
  • 40
  • 74
3
votes
2 answers

How to deserialize NSDate with SWXMLHash

I'm using SWXMLHash and have written an extension on NSDate for XMLElementDeserializable. I've followed how the basic types are extended at the end of this file. What I have looks like this: import Foundation import SWXMLHash struct BlogPost:…
Xeaza
  • 1,410
  • 1
  • 17
  • 21
3
votes
2 answers

iOS Cocoapods issue: No such module in parts of my project (custom folder & Apple Watch target)

I have trouble installing following cocoapod correctly: github.com/drmohundro/SWXMLHash Interestingly enough, I can access the framework "SWXMLHash" installed by the pod in my regular ViewController.swift but cannot access it in my Apple Watch…
Weiland
  • 31
  • 2
2
votes
1 answer

SWXMLHash parse Data object

I trying out with SWXMLHash and to mock a download from a website to parse, I created a file in the playground with the data. I got this as the response from URLSessionManager Data looks similar to: 3c3f786d 6c207665 7273696f 6e3d2731 ... But of…
koen
  • 5,383
  • 7
  • 50
  • 89
2
votes
1 answer

Swift Vapor SWXMLHash probably SWXMLHash error

I am building a application in Vapor. My website works fine on localhost but on the Heroku doesn't run correctly. I have got a list with elements from xml. Xml is parsing by SWXMLHash. Heroku printing only static header. I cant see any informations…
Piotr
  • 175
  • 1
  • 2
  • 11
2
votes
1 answer

Use of undeclared type in Swift 3

I have the following class to return a list of NOAA weather observation stations. I am using it to learn how to deal with XML. However, I am getting a "Use of undeclared type 'wxObservationStations'" as an error at func returnWxStation() ->…
Yrb
  • 8,103
  • 2
  • 14
  • 44
2
votes
1 answer

Parse XML request in Swift

I am just beginning to dabble around with Swift. I have the following get request using NSURLSession: let url = NSURL(string: "http://api.bart.gov/api/sched.aspx?cmd=arrive&orig=24th&dest=rock&key=MW9S-E7SL-26DU-VV8V") let task =…
jipot
  • 304
  • 3
  • 13
  • 34
1
vote
1 answer

Trouble parsing a self closure in XML using SWXMLHash

I'm having an issue with iterating through data when there is a self closing element. In the first example it will end up skipping everything, in the second example I have no issues and it grabs the data I need. Unbridled…
kris63
  • 31
  • 2
1
vote
1 answer

Any easier way to convert XML to Plist?

I am seeking help with my process of converting XML to Swift dictionary then to a Plist. TL;DR I am using SWXMLHash to parse an XML to Swift dictionary then to Plist so that users can edit data in an easier way. Parsing works fine but I was not able…
Matt
  • 674
  • 11
  • 25
1
vote
1 answer

Unable to change global variable from within function

I am trying to change a global variable from within an alamofire variable but am having issues doing it. Here is my code: var projects = [[String]]() var xmlToParse = String() var postTitle = String() var postLink = String() override func…
dan boy
  • 89
  • 8
1
vote
1 answer

Issue in converting xml to custom type using swxmlhash

Am trying to convert the following xml tag: 122 to an equivalent type, but am not able to find any way from the provided examples to do it. Have tried, struct Profile: XMLIndexerDeserializable { // some other elements... …
Shane D
  • 834
  • 9
  • 23
1
vote
0 answers

SWXMLHash Issue in Swift

I am using SWXMLHash for parsing the data from server. It crashes when I have & in my data. let responseString = NSString(data: data!, encoding: NSUTF8StringEncoding) let str = responseString as! String let xml = SWXMLHash.parse(str) //let xml =…
Shaheera
  • 307
  • 1
  • 15
1
2 3 4