I am considering using Ruby savon for SOAP. For purely masochistic reasons, I have to deal with SOAP elements that have attributes.
So, there is no problem, there is an example on the doc files website sacon, which emphasizes this ability:
{ :person => "Eve", :attributes! => { :person => { :id => 666 } } }.to_soap_xml "<person id=\"666\">Eve</person>"
My problem is how to set attributes for child elements, for example, let's say I add a child address element to a person:
{ :person => {:address => ""}, :attributes! => { :person => { :id => 666 } } }.to_soap_xml
Now I want to add the id attribute to the address element:
It is not necessary if I put the address in the hash of the attributes:
{ :person => {:address => ""}, :attributes! => { :person => { :id => 666, :address => {:id => 44 }} }}.to_soap_xml
So my question is: how can I get this?
<person id=666><address id=44></address></person>
soap ruby savon
Sameer c
source share