I have the following XML string. I am trying to parse with XMLMapper (3rd party library).
I need to create array of
The xml is as follow;
<RandomDecimals>
<decimal>98258979</decimal>
<decimal>1000002218</decimal>
<decimal>1000002102</decimal>
<decimal>1000005713</decimal>
<decimal>1000002035</decimal>
<decimal>1000001434</decimal>
<decimal>1000001066</decimal>
<decimal>1000001498</decimal>
<decimal>1000002313</decimal>
<decimal>1000016914</decimal>
<decimal>1000017021</decimal>
<decimal>1000019039</decimal>
<decimal>52373625</decimal>
</RandomDecimals>
The code to parse to object is as follows;
class DecimalElement: XMLMappable {
var nodeName: String!
var decimal: String?
required init(map: XMLMap) {
}
func mapping(map: XMLMap) {
decimal <- map["decimal"]
}
}
class Response: XMLMappable {
var nodeName: String!
var shouldReset: Bool!
var randomDecimals: [DecimalElement]?
required init(map: XMLMap) {
}
func mapping(map: XMLMap) {
randomDecimals <- map["RandomDecimals.decimal"]
shouldReset <- map["ShouldReset"]
}
As a summary, I need to take decimals into randomDecimals array. But the I need to do it with XMLMapper
.
What am I doing wrong?
BR,
Erdem