サービスからSOAP応答を受け取ったので、解析する必要があります。私は立ち往生している。この応答では、「Gzk0P」の値を底に向かって取得したいと考えています。 XMLの下の私の解析メソッドを見てください。ありがとう!SOAP応答を解析するNSXMLParser
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://mysvc.myservice.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns2="http://xml.apache.org/xml-soap" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:createSubmissionResponse>
<return xsi:type="ns2:Map">
<item>
<key xsi:type="xsd:string">error</key>
<value xsi:type="xsd:string">OK</value>
</item>
<item>
<key xsi:type="xsd:string">link</key>
<value xsi:type="xsd:string">Gzk0P</value>
</item>
</return>
</ns1:createSubmissionResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict {
if ([elementName isEqualToString:@"key"]) {
NSString *title = [attributeDict valueForKey:@"value"];
NSString *test = @"";
}
}
この方法を使用しました。私はおそらく最もクリーンな方法でそれをやっていないが、私は '文字列'が 'リンク'と等しい場合、私は興味がある値が次に来ることを知っているときに 'currentElementValue == "リンク "をクリックして、私は、私は..とにかく5 char値に等しくなるようにcurrentElementValueを再度更新します。ありがとう! –