2017-04-06 28 views
0

我生成的C到使用soapcpp2工具從gSOAP的44年2月8日XML編碼器 我輸入soapcpp2是一個.h文件:gSOAP的Ç工會XML編碼

union U_u 
{ 
     int i; 
     int j; 
     int k; 
}; 

struct A_t { 
     int choice_type; 
     int __union_choice_type; 
     union U_u choice; 
}; 

運行soapcpp2 -c後並與我的測試代碼鏈接後,我得到編碼的XML爲

<A-t> 
    <choice-type>1</choice-type> 
    <i>0</i> 
</A-t> 

爲什麼聯合元素名稱從xml中丟失? 我期待這樣的:

<A-t> 
    <choice-type>1</choice-type> 
    <choice> 
     <i>0</i> 
    </choice> 
</A-t> 

是否有一個選項,包括工會名稱也是在XML?

回答

0

工會提供了一個元素的選擇,所以<i>,<j><k>之一將顯示在XML中。

如果你想這些的<choice>是子元素,然後使用:

struct A_t { 
    int choice_type; 
    struct A_t_choice { 
     int __union_choice_type; 
     union U_u choice; 
    } choice; 
};