Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 如何获取SOAP响应数据?_Objective C_Xml_Serialization_Soap - Fatal编程技术网

Objective c 如何获取SOAP响应数据?

Objective c 如何获取SOAP响应数据?,objective-c,xml,serialization,soap,Objective C,Xml,Serialization,Soap,这是webservice返回的XML响应 <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XM

这是webservice返回的
XML
响应

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="urn:OrientalServices1">
<SOAP-ENV:Body>
<ns1:Get_CategoryResponse xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/">
<return xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:responseGetCategoryByID[11]">
<item xsi:type="tns:responseGetCategoryByID">
    <id xsi:type="xsd:int">1</id>
    <name xsi:type="xsd:string">國內</name>
</item>
<item xsi:type="tns:responseGetCategoryByID">
    <id xsi:type="xsd:int">2</id>
    <name xsi:type="xsd:string">財經</name>
</item>
<item xsi:type="tns:responseGetCategoryByID">
    <id xsi:type="xsd:int">3</id>
    <name xsi:type="xsd:string">社會</name>
</item>
<item xsi:type="tns:responseGetCategoryByID">
    <id xsi:type="xsd:int">4</id>
    <name xsi:type="xsd:string">國際</name>
</item>
<item xsi:type="tns:responseGetCategoryByID">
    <id xsi:type="xsd:int">10</id>
    <name xsi:type="xsd:string">龍門陣</name>
</item>
<item xsi:type="tns:responseGetCategoryByID">
    <id xsi:type="xsd:int">11</id>
    <name xsi:type="xsd:string">言論</name>
</item>
<item xsi:type="tns:responseGetCategoryByID">
    <id xsi:type="xsd:int">6</id>
    <name xsi:type="xsd:string">名家</name>
</item>
<item xsi:type="tns:responseGetCategoryByID">
    <id xsi:type="xsd:int">8</id>
    <name xsi:type="xsd:string">娛樂</name>
</item>
<item xsi:type="tns:responseGetCategoryByID">
    <id xsi:type="xsd:int">5</id>
    <name xsi:type="xsd:string">體育</name>
</item>
<item xsi:type="tns:responseGetCategoryByID">
    <id xsi:type="xsd:int">7</id>
    <name xsi:type="xsd:string">專題</name>
</item>
<item xsi:type="tns:responseGetCategoryByID">
    <id xsi:type="xsd:int">9</id>
    <name xsi:type="xsd:string">特輯</name>
</item>
</return>
</ns1:Get_CategoryResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

1.
國內
2.
財經
3.
社會
4.
國際
10
龍門陣
11
言論
6.
名家
8.
娛樂
5.
體育
7.
專題
9
特輯

在这个
XML
中,我在一个数组中得到了11项。如何对其进行反序列化并逐个获取项目?

您可以使用XML解析器

Cocoa中支持几种方法,但既然您提出了这样一个一般性的问题,我所能做的就是提供一个一般性的答案

苹果开发者网站上有一个