How to parsing a XML file with NSXML Parser
===

I has an XML file like this，now i use NSXMLParser to parse it.

    <? xml version ='1.0' encoding="UFT-8"?>
    <!DOCTYPE plist PUBLIC "-//apple//DTD PLIST 1.0//EN" "http://www.apple/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <Data>
       <item>
         <date>2012-07-24</date>
         <name>A</name>
         <count>100</count>
         <startDate>2012-07-24</startDate>
         <stopDate>2012-07-24</stopDate>	
       </item>
       <item>
         <date>2012-07-24</date>
         <name>A</name>
         <count>100</count>
         <startDate>2012-07-24</startDate>
         <stopDate>2012-07-24</stopDate>
       </item>
   
    </Data>
    </plist>

use a IBAtion to parse the xml file like 

        - (IBAction)Parser:(id)sender {
        NSXMLParser *xmlParser = [[NSXMLParser alloc]initWithContentsOfURL:[[NSBundle mainBundle]      URLForResource:@"file2" withExtension:@"xml"]];
        [xmlParser setDelegate:self];
        BOOL flag =[xmlParser parse];
        if (flag) {
            NSLog(@"OK");
        } else {
            NSLog(@"false");
        }
        [xmlParser release];
    }


    -(void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:    (NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict

    {
         NSLog(@"%@found a %@ element",self,elementName);
         if ([elementName isEqual:@"Data"]) {
            [data release];
            data = [[Data alloc]init];
        
        [data setParentParserDelegate:self];
        [parser setDelegate:data];
    }
}

there is printf "OK" and no printf "NSLog(@"%@found a %@ element",self,elementName)"
