Iphone libxml2解析器问题。如何处理来自服务器的错误消息?我该如何对待看门狗
我对同一个代码有几个问题Iphone libxml2解析器问题。如何处理来自服务器的错误消息?我该如何对待看门狗,iphone,objective-c,xml,networking,libxml2,Iphone,Objective C,Xml,Networking,Libxml2,我对同一个代码有几个问题 首先,我如何处理来自服务器的错误消息 如果返回的XML与我的对象类型不匹配,我的应用程序将被阻止 如何处理网络超时(看门狗) 任何关于我的代码的其他建议将不胜感激。 我的代码: xmlTextReaderPtr reader = xmlReaderForMemory([DecryResponse bytes], [DecryResponse length], NULL, NULL, (XML_PARSE_NOBLANKS | XML_PARSE_NOCDATA | X
xmlTextReaderPtr reader = xmlReaderForMemory([DecryResponse bytes], [DecryResponse length], NULL, NULL, (XML_PARSE_NOBLANKS | XML_PARSE_NOCDATA | XML_PARSE_NOERROR | XML_PARSE_NOWARNING));
NSString * currentTagName =nil;
NSString * currentTagValue= nil;
char *temp = nil;
while (true) {
if(!xmlTextReaderRead(reader))break;
switch (xmlTextReaderNodeType(reader)) {
case XML_READER_TYPE_ELEMENT:
temp = (char *)xmlTextReaderConstName(reader);
currentTagName =[NSString stringWithCString:temp encoding:NSUTF8StringEncoding];
continue;
case XML_READER_TYPE_TEXT:
temp =(char *)xmlTextReaderConstValue(reader);
currentTagValue = [NSString stringWithCString:temp encoding:NSUTF8StringEncoding];
if ([currentTagName isEqual:@"Account"]) {
SW.Account =[currentTagValue intValue];}
if ([currentTagName isEqual:@"SessionNumber"]) {
SW.SessionNumber = currentTagValue; }
if ([currentTagName isEqual:@"OpCode"]) {
SW.OpCode = [currentTagValue intValue];}
default:continue;
}
}