I have a Solace JMS Messaging Box which I am automating the administration of, and the device uses lots of very small XML posts to configure. Since the device has so very many commands in its XML spec, I need a way to create arbitrary XML requests.
The XML looks like:
<rpc semp-version="soltr/5_5">
<create>
<message-vpn>
<vpn-name>developer.testvpn</vpn-name>
</message-vpn>
</create>
</rpc>
And a second call to change a setting might look like this:
<rpc semp-version="soltr/5_5">
<message-vpn>
<vpn-name>developer.testvpn</vpn-name>
<export-policy>
<no>
<export-subscriptions/>
</no>
</export-policy>
</message-vpn>
</rpc>
Since there are many commands in the XML spec, I’m looking for a way to create them freely from something like dot name space. eg:
mycall = SolaceXML()
mycall.create.message_vpn.vpn_name="developer.testvpn"
mycall.message_vpn.vpn_name='developer.testvpn'
mycall.message_vpn.export_policy.no.export_subscription
UPDATE
I have posted my solution below. Its not as small as I’d like it but it works for me.
K
I have found a solution in the mean time. Hopefully this helps someone else. This solution builds nested dictionary objects from dot name space calls, and then converts it to XML.