Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.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
Iphone 使用soapweb服务解析Xml_Iphone_Web Services_Soap - Fatal编程技术网

Iphone 使用soapweb服务解析Xml

Iphone 使用soapweb服务解析Xml,iphone,web-services,soap,Iphone,Web Services,Soap,我正在尝试使用教程解析从web服务接收的xml文件 我将接收到的数据初始化为NSString,如下所示 NSString *theXML = [[NSString alloc] initWithBytes: [webData mutableBytes] length:[webData length] encoding:NSUTF8StringEn

我正在尝试使用教程解析从web服务接收的xml文件

我将接收到的数据初始化为NSString,如下所示

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


1Hihttp://10.25.4.49/monsoonstore/Category/50X50.GIF
当我解析数据时,我的解析器不会像应该的那样读取根标记,而是从信封标记开始。。如何让解析器解析从服务器(即

<Root><Record><catid>1</catid><catname>Hi</catname><catlogo>http://10.25.4.49/monsoonstore/Category/50X50.GIF</catlogo></Record></Root>
1Hihttp://10.25.4.49/monsoonstore/Category/50X50.GIF

如何使用正确的标记来解析此webData

您可以使用TouchXML解析器获得更好的结果,然后在XML解析器函数中使用

NSString *responseString = [[[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding] autorelease];
CXMLDocument *xmlParser = [[[CXMLDocument alloc] initWithXMLString:responseString options:0 error:nil] autorelease];
NSArray *returnNodes = NULL;
returnNodes = [xmlParser nodesForXPath:@"//Root" error:nil];
.
.
.

您可以使用TouchXML解析器来获得更好的和期望的结果,然后使用in-XML解析器函数

NSString *responseString = [[[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding] autorelease];
CXMLDocument *xmlParser = [[[CXMLDocument alloc] initWithXMLString:responseString options:0 error:nil] autorelease];
NSArray *returnNodes = NULL;
returnNodes = [xmlParser nodesForXPath:@"//Root" error:nil];
.
.
.

请通过以下链接,您会得到更好的想法,1)kosmaczewski.net 2)3)4)要在iPhone中解析XML,您需要使用NSXMLParser。如果可能的话,那么只要给我一个url,从那里你可以得到这些xml数据,我会尝试我自己的,然后我会给你解决方案。“web服务链接”是@“SOAPAction”请通过下面的链接,你会有更好的想法,1)kosmaczewski.net 2)3)4)要在iPhone中解析XML,你需要使用NSXMLParser。如果可能的话,那么只需给我一个url,你从那里获取XML数据,我会尝试自己的,然后我会给你解决方案。web服务链接是@“SOAPAction”