调用了soap web server上的方法,返回如下数据,我保存在theXML中
NSString *theXML = [[NSString alloc] initWithBytes:[webData mutableBytes]
length:[webData length]
encoding:NSUTF8StringEncoding];
-------------打印theXML---------------
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:xmethods-delayed-quotes" xmlns:ns2="http://xml.apache.org/xml-soap" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body><ns1:SelectTimeResponse><result SOAP-ENC:arrayType="ns2:Map[1]" xsi:type="SOAP-ENC:Array">
<item xsi:type="ns2:Map">
<item><key xsi:type="xsd:string">userId</key><value xsi:type="xsd:string">007</value></item>
<item><key xsi:type="xsd:string">workTime</key><value xsi:type="xsd:string">2014-01-15 09:22:10</value></item>
<item><key xsi:type="xsd:string">offTime</key><value xsi:type="xsd:string">2014-01-14 18:02:00</value></item>
<item><key xsi:type="xsd:string">name</key><value xsi:type="xsd:string">007name</value></item>
</item>
</result></ns1:SelectTimeResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
怎么解析theXML,得到我想要的数据,并保存在一个数组中??
有效数据:
007
2014-01-15 09:22:10
2014-01-14 18:02:00
007name
谢谢啦!
------解决方案--------------------
按照那个Schema解就行了,就是xml啊