解析soap响应(iphone/touchxml)时出现问题

解析soap响应(iphone/touchxml)时出现问题,xml,iphone,soap,touchxml,Xml,Iphone,Soap,Touchxml,我创建了一个Web服务,它可以工作,问题在于Web服务的响应。 我有这个xml(我想用touchxml解析),问题是touchxml发现了两个xml,一个在另一个内部,它会崩溃。 我的问题是,如何解析这个xml?如何删除所有的东西,比如soap-env、xmlns <?xml version="1.0" encoding="ISO-8859-1"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/so

我创建了一个Web服务,它可以工作,问题在于Web服务的响应。 我有这个xml(我想用touchxml解析),问题是touchxml发现了两个xml,一个在另一个内部,它会崩溃。 我的问题是,如何解析这个xml?如何删除所有的东西,比如soap-env、xmlns

<?xml version="1.0" encoding="ISO-8859-1"?>
<SOAP-ENV:Envelope 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/"><SOAP-ENV:Body>
<ns1:getCategoriesResponse xmlns:ns1="http://192.168.1.30/wyws/server.php"><return xsi:type="xsd:string">

    <?xml version="1.0" encoding="UTF-8"?>
    <categories>
       <category id="1" desc="Encontrar Códigos " icon="wy">Código </category>
       <category id="3" desc="" icon="farm">Far</category>
       <category id="5" desc="" icon="gas">Gas</category>
       <category id="6" desc="" icon="hos">Hos</category>
       <category id="7" desc="" icon="pol">Pol</category>
    </categories>

</return></ns1:getCategoriesResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
然后

-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{

    NSLog(@"DONE. Received Bytes: %d", [webData length]);

    NSString *theXML = [[NSString alloc] initWithBytes: [webData mutableBytes] length:[webData length] encoding:NSISOLatin1StringEncoding];


NSLog(theXml);
....
}

我写了这个,它不是很优雅,但它很有效

 NSRange in = [tmpTheXml rangeOfString:@"<return xsi:type=\"xsd:string\">"];
 NSRange fi = [tmpTheXml rangeOfString:@"</return>"];
 int inic = in.location + in.length;
 NSRange tmprange = {inic,fi.location - inic} ;
 tmpTheXml = [tmpTheXml substringWithRange:tmprange];
NSRange in=[tmpTheXml rangeOfString:@”“;
NSRange fi=[tmpTheXml rangeOfString:@”“;
int inic=英寸位置+英寸长度;
NSRange tmprange={inic,fi.location-inic};
tmpTheXml=[tmpTheXml substringWithRange:tmprange];
 NSRange in = [tmpTheXml rangeOfString:@"<return xsi:type=\"xsd:string\">"];
 NSRange fi = [tmpTheXml rangeOfString:@"</return>"];
 int inic = in.location + in.length;
 NSRange tmprange = {inic,fi.location - inic} ;
 tmpTheXml = [tmpTheXml substringWithRange:tmprange];