-
-
Notifications
You must be signed in to change notification settings - Fork 605
Open
Description
I'm using zeep version 4.3.1.
Is there a way to avoid ignoring the nested elements with only one child in the response?
For example, given this xml response:
<?xml version=\'1.0\' encoding=\'UTF-8\'?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<Operation1Response xmlns="http://www.example.com/XML/Schema/" xmlns:ns2="http://www.example.com/types/">
<ReponseStandard>
<ns2:Resultat>false</ns2:Resultat>
<ns2:Anomalie>
<ns2:Severite>1</ns2:Severite>
<ns2:Message>Error Message</ns2:Message>
</ns2:Anomalie>
</ReponseStandard>
</Operation1Response>
</S:Body>
</S:Envelope>
zeep gives me this structure:
{
'Resultat': False,
'Anomalie': {
'Severite': 1,
'Message': 'Error Message'
}
}
while
<?xml version='1.0' encoding='UTF-8'?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<Operation2Response xmlns="http://www.example.com/XML/Schema/" xmlns:ns2="http://www.example.com/types/">
<ReponseStandard>
<ns2:Resultat>true</ns2:Resultat>
</ReponseStandard>
<ReponseSpecifique>
<Number>0</Number>
</ReponseSpecifique>
</Operation2Response>
</S:Body>
</S:Envelope>
gives:
{
'ReponseStandard': {
'Resultat': True,
'Anomalie': None
},
'ReponseSpecifique': {
'Number': 0,
'Message': None
}
}
I get that this way of parsing avoids typing overhead (having to specify Operation1Response), but it seems wrong to ignore ReponseStandard in the first example. I would expect to have:
{
'ReponseStandard': {
'Resultat': False,
'Anomalie': {
'Severite': 1,
'Message': 'Error Message'
}
}
}
Metadata
Metadata
Assignees
Labels
No labels