如何将XML字符串转换为JSON

时间:2013-11-15 01:31:52

标签: xml json web-services

我在这个主题上看到了很多帖子,但它们都过时了。

所以我有一个包含大量复杂类型的WSDL文件,例如:

<complexType name="RM-CTRL-INFO-S">
<!--  RM_CTRL_INFO_S  -->
<sequence>
<element name="ctrl-type" type="xsd:int" minOccurs="1" maxOccurs="1"/>
<!--  RM_CTRL_INFO_S::ctrl_type  -->
<element name="fw-ver" type="ns:Array60Ofbyte" minOccurs="1" maxOccurs="1" nillable="true"/>
<!--  RM_CTRL_INFO_S::fw_ver  -->
<element name="ram-size" type="xsd:int" minOccurs="1" maxOccurs="1"/>
<!--  RM_CTRL_INFO_S::ram_size  -->
<element name="status" type="xsd:int" minOccurs="1" maxOccurs="1"/>
<!--  RM_CTRL_INFO_S::status  -->
<element name="bg-task-rate" type="xsd:int" minOccurs="1" maxOccurs="1"/>
<!--  RM_CTRL_INFO_S::bg_task_rate  -->
<element name="valid-cache-modes" type="xsd:int" minOccurs="1" maxOccurs="1"/>
<!--  RM_CTRL_INFO_S::valid_cache_modes  -->
<element name="autoclear-mode" type="xsd:int" minOccurs="1" maxOccurs="1"/>
<!--  RM_CTRL_INFO_S::autoclear_mode  -->
<element name="tot-disks" type="xsd:int" minOccurs="1" maxOccurs="1"/>
<!--  RM_CTRL_INFO_S::tot_disks  -->
<element name="tot-raids" type="xsd:int" minOccurs="1" maxOccurs="1"/>
<!--  RM_CTRL_INFO_S::tot_raids  -->
<element name="tot-vols" type="xsd:int" minOccurs="1" maxOccurs="1"/>
<!--  RM_CTRL_INFO_S::tot_vols  -->
<element name="stripe-size" type="ns:Struct-1" minOccurs="1" maxOccurs="1"/>
<!--  RM_CTRL_INFO_S::stripe_size  -->
<element name="single-bit-ecc-err" type="xsd:unsignedInt" minOccurs="1" maxOccurs="1"/>
<!--  RM_CTRL_INFO_S::single_bit_ecc_err  -->
<element name="multi-bit-ecc-err" type="xsd:unsignedInt" minOccurs="1" maxOccurs="1"/>
<!--  RM_CTRL_INFO_S::multi_bit_ecc_err  -->
<element name="patrol-start-err" type="xsd:unsignedInt" minOccurs="1" maxOccurs="1"/>
<!--  RM_CTRL_INFO_S::patrol_start_err  -->
<element name="max-devices" type="xsd:int" minOccurs="1" maxOccurs="1"/>
<!--  RM_CTRL_INFO_S::max_devices  -->
</sequence>
</complexType>

从这些生成JSON的好方法是什么?

0 个答案:

没有答案