Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.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
iOS-解析xml数据集_Ios_Xml_Parsing_Dataset_Nsxmlparser - Fatal编程技术网

iOS-解析xml数据集

iOS-解析xml数据集,ios,xml,parsing,dataset,nsxmlparser,Ios,Xml,Parsing,Dataset,Nsxmlparser,我要解析的Xml数据 <DataTable xmlns="http://tempuri.org/“> <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas- microsoft-com:xml-diffgram-v1"> <NewDataSet xmlns=“"> <Products diffgr:id="P

我要解析的Xml数据

<DataTable xmlns="http://tempuri.org/“>

<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-     microsoft-com:xml-diffgram-v1">
<NewDataSet xmlns=“">

<Products diffgr:id="Products1" msdata:rowOrder="0">
<ItemCode>001G1-R25111-1701</ItemCode>
<ItemName>Autocad 2015</ItemName>
<Price>160714.000000</Price>
</Products>
<Products diffgr:id="Products2" msdata:rowOrder="1">
<ItemCode>011-0656</ItemCode>
<ItemName>"SVC, HARDWARE TEST 1"</ItemName>
<Price>0.000000</Price>
</Products>
<Products diffgr:id="Products3" msdata:rowOrder="2">
<ItemCode>011-0657</ItemCode>
<ItemName>"SVC, HARDWARE TEST 2"</ItemName>
<Price>0.000000</Price>
</Products>

</NewDataSet>
</diffgr:diffgram>
</DataTable>

This is my view.h
#import <Foundation/Foundation.h>

@interface view : NSObject
{
int *itemcode;
NSString *itemname;
NSString *price;
}


@property (nonatomic, assign) int *itemcode;
@property (nonatomic, retain) NSString *itemname;
@property (nonatomic, retain) NSString *price;
@end

view.m

#import "view.h"

@implementation view
@synthesize itemcode,itemname,price;

@end
我没有得到解析后的数据,它在DiEndElement中崩溃了。
“NSUnknownKeyException”,原因:“[setValue:forUndefinedKey::此类不符合key ItemCode的键值编码要求。”

在view.h文件中,u应将变量声明为

 int * ItemCode;
 NSString * ItemName;
 NSString * Price;
变量应等于标记名

 int * ItemCode;
 NSString * ItemName;
 NSString * Price;