@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
NSString *path = @"/Users/hoperun1/Library/Application Support/iPhone Simulator/7.0/Applications/9C1F64D5-4450-4818-88A2-5843B451D69A/Documents/notes.xml";
NSURL *url = [NSURL fileURLWithPath:path];
NSXMLParser *parse = [[NSXMLParser alloc]initWithContentsOfURL:url];
parse.delegate = self;
[parse parse];
return YES;
}
-(void)parser:(NSXMLParser *)parser didStartMappingPrefix:(NSString *)prefix toURI:(NSString *)namespaceURI
{
}
-(void)parserDidStartDocument:(NSXMLParser *)parser
{
_notes = [NSMutableArray new];
}
-(void)parser:(NSXMLParser *)parser parseErrorOccurred:(NSError *)parseError
{
NSLog(@"%@",parseError);
}
-(void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict
{
_currentTagName = elementName;
//自行解析...
}