Questions tagged [swxmlhash]
SWXMLHash is a third-party XML parser for swift
46
questions
0
votes
0
answers
17
views
Is there a way to deal with optionals of simple types that require a custom deserializer?
I have a struct which has its own deserialize method and optional DateComponents, which in turn, require their own deserialize method.
The struct currently looks like this:
public struct ...
0
votes
1
answer
102
views
Swift, xml parsing with SWXMLHASH
I 've been trying to parse some part of xml including CDATA and I don't understand why the cdata was not showing at all. I ve been trying to solve this problem with SWXMLHASH
Below is the xml
<DOC ...
1
vote
1
answer
63
views
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 ...
0
votes
0
answers
97
views
SWXMLHash parse nested children
Playing around with SWXMLHash, I am trying to pull out an element and then get its info. My xml file is large and I'd like to split up the parsing in smaller functions.
For example, this is from the ...
0
votes
0
answers
43
views
Deserializing a XML sequence with SWXMLHash
I want to deserialize a sequence of a group of tags with SWXMLHash.
This is an example XML:
<?xml version="1.0"?>
<Places>
<Place>
<name>First Place</...
1
vote
1
answer
205
views
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 ...
0
votes
0
answers
83
views
How to get only part of an element's text using SWXMLHash
Say I have an XML file like
<root>
<h:table>
<h:tr> we have
<h:td>Apples</h:td>,
<h:td>Bananas</h:td>,
</h:tr>
...
0
votes
2
answers
200
views
drmohundro/SWXMLHash and escaping values in Swift
I have working on a project that handles xml responses. After a search I found a library on github drmohundro/SWXMLHash that works inspired on the "Swifty JSON". After a while using it, I have ...
0
votes
0
answers
141
views
Unable to import module SWXMLHash
Running Xcode 9.3
I cloned the repo, opened the workspace and let the playground run.
I got an error:
No such module 'SWXMLHash'
So I closed down everything and ran again on the simulator. ...
2
votes
1
answer
525
views
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:
...
0
votes
2
answers
2k
views
Cannot assign 'AppDelegate' to 'UNUserNotificationCenterDelegate'
I'm following this tutorial: https://medium.com/flawless-app-stories/ios-remote-push-notifications-in-a-nutshell-d05f5ccac252
But for some reason, I'm getting
cannot assign 'AppDelegate' to '...
0
votes
1
answer
183
views
SWXMLHash: how to build struct for very deep XML?
I am now working on a complex XML parsing.
Here is the link: https://www.reddit.com/hot/.rss
I use Alamofire to fetch data:
protocol APIUsable {
}
struct API: APIUsable {
static func ...
0
votes
1
answer
251
views
SWXMLHash can't parse a [XMLIndexer]
I am trying for first time to parse a XML file and I am using SWXMLHash.
My xml file is:
<weatherdata xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://...
0
votes
1
answer
79
views
SWXMLHash EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
I just converted my project to swift 4, but I having error when I emulate my app with SWXMLHash:
var code: Int! = nil
var message: String! = nil
var paramsContent: String! = nil
let ...
3
votes
2
answers
636
views
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 '...
0
votes
2
answers
61
views
Swift: Error ignores try statement
In my code I'm deserialising some XML using the SWXMLHash library. Its .value() method has the throws keyword in its declaration, as do any custom deserialise functions.
I have the following line of ...
0
votes
0
answers
369
views
Index out of range during tableView.reloadData
I am having performance issues and index out of range errors during some refreshes. Not all, but I am struggling to troubleshoot it.
Basically, the app will collect data from an RSS feed and display ...
1
vote
1
answer
348
views
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()...
0
votes
1
answer
245
views
Deserialisation error with SWXMLHash
I have the following XML structure (this is a stripped-down example):
<Root>
<SomeData>Some value</SomeData>
...
<ClientInfo>
<Client>MD</Client&...
38
votes
1
answer
14k
views
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 ...
0
votes
1
answer
149
views
Handling missing properties when deserializing xml using SWXMLHash
I've been following the examples at SWXMLHash to deserialize an XML file. It is working quite well, but I am not sure how to handle cases when the XML input is incomplete:
For example, suppose the ...
0
votes
2
answers
1k
views
Get Value From XML Response Swift
I am using a Swift xml parser library located Here. I am looking to get a specific value from the below XML that has a certain value.
The below XML shows a list of apps installed on a device and then ...
-1
votes
1
answer
111
views
Swift variable to choose struct
new approach to ask my question. I thought it was clear but apparently
not. :-D 2nd chance.
I use SWXMLhash to get information from websites. For each website i need a different struct, because the ...
0
votes
1
answer
108
views
swxmlhash conditional deserialization that may return nil
I'm using SWXMLHASH Swift library to parse some 3rd party XML data. This data can sometimes be returned with values that are not valid for my application. When this happens I wish to ignore this data ...
0
votes
1
answer
85
views
Improve efficiency on downloading multiple XML files and parsing them
I'm downloading five XML files from the web server using Alamofire and parsing them using SWXMLHash. The last file depends on the first four files in a way that some of its entries refer to the ...
1
vote
1
answer
94
views
Issue in converting xml to custom type using swxmlhash
Am trying to convert the following xml tag:
<MTag media="wifi">122</MTag>
to an equivalent type, but am not able to find any way from the provided examples to do it.
Have tried,
struct ...
2
votes
1
answer
410
views
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 ...
0
votes
2
answers
1k
views
Unable to parse XML from Webservice using SWXMLHash
I have the following code using SWXMLHash - the XML parser however does not appear to be able to process it. I have checked the URL to make sure it returns data:
let baseUrl = "http://apps.hha.co.uk/...
2
votes
1
answer
4k
views
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'" ...
-2
votes
1
answer
915
views
Swift 3 alamofire + SWXMLHash
In Swift 2 had a method that could parse xml response, but its not working in Swift 3.
Here is my Swift 2.0 method:
Alamofire.request(.GET, "www.example.com", headers: headers)
.response { (...
0
votes
1
answer
108
views
SWXMLHash compact root element
I have a question I hope will be quick. I am parsing XML returned by eBay’s API using SWXMLHash for Swift. Some of the returns get quite verbose.
such as:
xml["findCompletedItemsResponse"][“...
3
votes
3
answers
9k
views
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 ...
0
votes
1
answer
395
views
Deserialising a class with SWXMLHash in Swift 3
I'm trying to deserialise XML to a class using the example provided at the end of the readme, but it's raising the same compile time error as originally provoked this question.
method 'deserialize' ...
0
votes
0
answers
95
views
Save data from SWXMLHash
I got this set of response data:
<delivery_zones>
<zone>3</zone>
<zone_name>Within Klang Valley</zone_name>
</delivery_zones&...
1
vote
0
answers
142
views
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 ...
0
votes
1
answer
223
views
How should i save the xml child element value? [swift]
i have this set of xml that i needed to save the category of price_options, but how do i save it? For now i using SWXMLHash, but i don't know how to save it:
<rss version="2.0">
<channel>
...
3
votes
2
answers
512
views
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:
...
0
votes
1
answer
438
views
How can I use a third party library: SWXMLHash in the playground ?
I'm using SWXMLHash to parse an xml file in my project, It works fine in the project but I would like to make some tests in a playground.
I keep having an error when I want to use the library in the ...
3
votes
2
answers
868
views
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....
1
vote
1
answer
266
views
how to check if parsed rss variable contain exact element in swift 2
I have a rss link which I parse it using SWXMLHash and then I use it's elements like below but when an element is missing in the rss I get below error message!
how can I check if rss contain for ...
0
votes
1
answer
851
views
how to use more efficiently SWXMLHash and how to set the class that will receive the data properly?
I'm building a project for a train schedule app, and I'm using an API that returns an XML file,to manipulate the data i'm using the library called SWXMLHash.
I need to extract the name of the ...
0
votes
1
answer
563
views
SWXMLHash iterating Error
I am new to Swift, writing my first application with network requests. For testing purposes, I created an application with the frameworks Alamofire and SWXMLHash for parsing the xml-data from the ...
0
votes
1
answer
1k
views
Loop through xml NSData variable and get values in swift 2.1
I'm new to swift programming.
I wrote a code which gets xml output from rss feed and parse it into NSDATA type,
then I want to get title and image src values from it in a loop and send them to a ...
1
vote
1
answer
784
views
Can't return value parsing XML using SWXMLHash in Swift
When I try to show "50%", which is taken from
forecast > area > forecast-period > text > probability_of_precipitation
it comes up with "nil" on my label in the storyboard.
I have this snippet of ...
2
votes
1
answer
1k
views
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=...
4
votes
1
answer
3k
views
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)")...