[Major Edit based on experience since 1st post two days ago.]
I am building a Python SOAP/XML script using Suds, but am struggling to get the code to generate SOAP/X
There's an even easier way - no need for any Reg Ex or exciting iterators ;)
First, define the plugin:
class PrunePlugin(MessagePlugin):
def marshalled(self, context):
context.envelope = context.envelope.prune()
Then use it when creating the client:
client = Client(url, plugins=[PrunePlugin()])
The prune() method will remove any empty nodes, as documented here: http://jortel.fedorapeople.org/suds/doc/suds.sax.element.Element-class.html