当前位置: 代码迷 >> Iphone >> xml解析,求大神帮忙??解决办法
  详细解决方案

xml解析,求大神帮忙??解决办法

热度:74   发布时间:2016-04-25 06:14:42.0
xml解析,求大神帮忙??
1.xml如下所示

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GetCircularTypeResponse xmlns="http://tempuri.org/">
<GetCircularTypeResult>
  内容??
</GetCircularTypeResult>
</GetCircularTypeResponse>
</soap:Body>
</soap:Envelope>


2.使用good api,GDataXMLNode如何获取节点GetCircularTypeResult内容
  求大神帮忙
------解决方案--------------------


NSString *filePath = [[NSBundle mainBundle] pathForResource:@"1" ofType:@"xml"];  NSData *xmlData = [[NSMutableData alloc] initWithContentsOfFile:filePath];
  NSError *error; 
 GDataXMLDocument *doc = [[GDataXMLDocument alloc] initWithData:xmlData options:0 error:&error];
  if (doc == nil) { return nil; } 
 NSLog(@"%@", doc.GetCircularTypeResult); 
 [doc release]; 
 [xmlData release]; 



明白?
------解决方案--------------------
doc.GetCircularTypeResult===>这个GetCircularTypeResult可以为动态的吗?
比如我这次调用webservice的GetCircularType方法返回的内容包含在GetCircularTypeResult节点中,
我调用另一个方法GetCircular方法返回的内容包含在GetCircularResult中

另外小问一个问题,xml有命名空间的是怎么读取?
------解决方案--------------------
引用:
C/C++ code


NSString *filePath = [[NSBundle mainBundle] pathForResource:@"1" ofType:@"xml"];  NSData *xmlData = [[NSMutableData alloc] initWithContentsOfFile:filePath];
  NSError *error; 
 GDataXML……


doc.GetCircularTypeResult报错,提示不存在?
------解决方案--------------------
有木有大牛???
  相关解决方案