Closed RichardAtDP closed 3 years ago
Hi @RichardAtDP, the colon in the name denotes the presence of the itunes
namespace. You could strip it with the shouldProcessNamespaces
property on XMLDecoder
, as described in README.md
. Does that answer your question?
Thanks @MaxDesiatov - I'm wondering how to integrate that option in a Combine pipeline?
Did you check the existing section about Combine? The decoding operator takes a decoder instance as an argument, you can pass your own with shouldProcessNamespaces
set as needed.
Got it! Thanks for your help.
For reference
let decoder = XMLDecoder();
decoder.shouldProcessNamespaces = true
self.cancellable = URLSession.shared.dataTaskPublisher(for: url)
.map { $0.data }
.decode(type: Response.self, decoder: decoder )
.catch { err in
return Just( Response(info:info), error: "\(err)") )
}
.replaceError(with: Response(info:info), error: "\(err)") )
.receive(on: DispatchQueue.main)
.eraseToAnyPublisher()
.assign(to: \.response, on: self)
How would one go about decoding a tag with a colon in it, for example: