string如下:
<?xml version="1.0" encoding="utf-8"?>
<NewDataSet>
<Table>
<CITY>Jupiter</CITY>
<STATE>FL</STATE>
<ZIP>33477</ZIP>
<AREA_CODE>561</AREA_CODE>
<TIME_ZONE>E</TIME_ZONE>
</Table>
</NewDataSet>
我想要獲取其中的city,也就是Jupiter,但是不用xml分析器,有沒有簡捷的方法實現?
NSArray *array = [yourXMLString componentsSeparatedByString:@"CITY"];
NSString *city = [[array objectAtIndex:1] stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"></"]];
其實還是分析器好用點