-
Notifications
You must be signed in to change notification settings - Fork 116
Open
Labels
bugSomething isn't workingSomething isn't working
Description
I am getting this kind of XML from an ancient SOAP server:
<aResponse><uesb2b:response xmlns:uesb2b="http://services.b2b.ues.ut.uhg.com/types/plans/" xmlns="http://services.b2b.ues.ut.uhg.com/types/plans/">
<uesb2b:st cd="GA" />
<uesb2b:obligId val="01" />
<uesb2b:shrArrangementId val="00" />
<uesb2b:busInsType val="CG" />
<uesb2b:metalPlans typ="Array"
…
When I decode with a struct like:
struct Response: Decodable {
let aResponse: String
}
Using:
let decoder = XMLDecoder()
decoder.shouldProcessNamespaces = true
let rsp = try decoder.decode(Response.self, from: data)
print(rsp.aResponse)
I get:
<uesb2b:response xmlns:uesb2b="http://services.b2b.ues.ut.uhg.com/types/plans/"xmlns="http://services.b2b.ues.ut.uhg.com/types/plans/">
<uesb2b:st cd="GA"/>
<uesb2b:obligId val="01"/>
<uesb2b:shrArrangementId val="00"/>
<uesb2b:busInsType val="CG"/>
<uesb2b:metalPlans typ="Array"arrayTyp="metalPlan[110]">
<uesb2b:metalPlan cd="AUWJ"rx="286A"level="S"min="0"max="0"/>
<uesb2b:metalPlan cd="AUWK"rx="286A"level="G"min="0"max="0"/><uesb2b:metalPlan …
(Newlines added for legibility). You can see the spaces on either side of the "
s in the attribute heavy nodes are removed (last two lines).
This makes the inner XML invalid.
Happy to fix the bug, just point me at the right code, thanks.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working