我想在iOS中使用GDataXML获取此XML中的“0”值:
<typeadresse type="java.lang.Integer">0</typeadresse>
我做
if ([unePosition elementsForName:@"idagencedepart"])
{
NSLog(@"position : %@",[unePosition elementsForName:@"idagencedepart"]);
}
但它打印出来:
position : (
"GDataXMLElement 0x11f73fb0: {type:1 name:idagencedepart xml:\"<idagencedepart type=\"java.lang.Integer\">4</idagencedepart>\"}"
)
如何获得“4”值?`
答案 0 :(得分:0)
示例中的信息不匹配。无论如何,我假设typeadresse = idagencepedart。你其实几乎得到了答案。要获得所需的价值:
GDataXMLElement *element = [[unePosition elementsForName:@"idagencepedart"] objectAtIndex:0];
NSString *value = [element stringValue];