2012-10-11 28 views
2

當供應薩翁:爲什麼選擇savon:屬性!不與對象調用對象的工作

hash = { 
       "Objects" => { //stuff here }, 
      :attributes! => { "Objects" => {"xsi:type" => "Something"}} 
     } 

我得到:

<Objects>...</Objects> 

當別的我得到預期的結果提供薩翁:

hash = { 
     "foo" => { //stuff here }, 
     :attributes! => { "foo" => {"xsi:type" => "Something"}} 
     } 

我得到:

<foo xsi:type="Something"></foo> 

我必須使用字符串「Objects」作爲鍵。我正在編寫第三方SOAP Web服務。我不能使用符號,因爲第一個字母會變成下限。

謝謝,

回答

0

你必須改變:屬性!於:@xsi:類型=> 「東西」,你想要的屬性

像散之內:

"foo"=>{:@xsi:type=>'something', //stuff here} 
相關問題