Open ArthurArslanaliev opened 7 years ago
I'm interested in this as well.
I would like to dump an object into XML. I didn't find a way to do that with zeep. I suppose I could use tostring
if I could get a hand on the corresponding etree.Element
.
I know I can set raw_response=True
to get a response as XML, but I want a single XML out of multiple requests, so I'm creating a parent object in zeep that contains a list of those element objects. I just don't know how to dump it into XML.
wondering if the issue has somehow been resolved.
Any updates on this?
I'm interested on this as well. Some services I am accessing with zeep have complex and deeply nested responses. Being able to query the responses xpath would make things a lot easier.
Zeep doesn't support xpath but since zeep uses lxml and and lxml.etree
elements does support xpath (as does stdlib xml.etree
) It should be possible to do so.
If an easy way is provided to access the underling lxml objects, a great many use cases would be readily available for you lib fellow consumers. And it would be much more efficient to access etree elements without extracting the raw xml (with raw_response=True
) and re-parsing the whole response again.
lxml also has the objectify
submodule, and objectified objects look awfully similar to zeep xsd objects, but in some context I find it useful to have access to the distinction of children and attributes that objectify provides.
Being able to have access to objectified responses would be even better I guess then pure etree objects, since it objectified elements seems to be a compatible superset of of etree Elements. (But if we can have access to etree objects it would also be trivial to get objectified instances from them).
Since zeep uses lxml to parse XML, is there a way to retrieve etree.Element from zeep object? For instance, I have the following code:
Thanks in advance!