I have the following XML structure (this is a stripped-down example):
<Root>
<SomeData>Some value</SomeData>
...
<ClientInfo>
<Client>MD</Client>
<Name>Massive Dynamic</Name>
</ClientInfo>
</Root>
With the following model:
struct ClientInfo : XMLElementDeserializable {
let Client : String
let Name : String
static func deserialize(_ node: XMLIndexer) throws -> ClientInfo {
return try ClientInfo(
Client: node["Client"].value(),
Name: node["Name"].value()
)
}
}
And I'm trying to parse the XML as follows:
let clientInfo : ClientInfo? = try? xml.children[0]["ClientInfo"].value()
However, it keeps failing with an ImplementationIsMissing
error as if my custom deserialize
function doesn't exist.
What gives?