title: Adding XML parsed data to NSMutableArray in iPhone?
body: <p>I am parsing XML response and adding it to NSMutableArray.The problem islast value of XML response is not getting added to NSMutableArray..Couldn't get where I am going wrong?
  My XML file looks like this:</p>
  
  <pre><code>&lt;IDList&gt;
     &lt;Employee&gt;
        &lt;ID&gt;1&lt;/ID&gt;
     &lt;/Employee
     &lt;Employee&gt;
        &lt;ID&gt;2&lt;/ID&gt;
     &lt;/Employee&gt;
     &lt;Employee&gt;
        &lt;ID&gt;3&lt;/ID&gt;
     &lt;/Employee&gt;
     &lt;Employee&gt;
        &lt;ID&gt;4&lt;/ID&gt;
     &lt;/Employee&gt;
  &lt;/IDList&gt;
  </code></pre>
  
  <p>And the code Iam writing for parsing is :</p>
  
  <pre><code> - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict {
  
  
  
   if([elementName isEqualToString:@"IDList"])
   {
   arr1=[[NSMutableArray alloc] init];
   drr1=[[NSMutableDictionary alloc] init];
  
   }
   if([elementName isEqualToString:@"Employee"])
   { 
   drr1=[[NSMutableDictionary alloc] init];        
   }
   srr1=[[NSMutableString alloc] init];
  
   } 
  
  
   -(void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string{
  
  
   [srr1 appendString:string];
   }
  
  
   - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName {
  
   if([elementName isEqualToString:@"ID"])
   {
  
   [drr1 setObject:srr1 forKey:@"ID"];
   [srr1 release],srr1=nil;
   return;
   }  
  
   if([elementName isEqualToString:@"Employee"]) 
   { 
   [arr1 addObject:drr1]; 
   }    
  
  
   if([elementName isEqualToString:@"IDList"])
   {
  
   [drr1 release];
  
   }
  
   [srr1 release],srr1=nil;
  
   }
  </code></pre>
  
  <p>The result I could see in arr1 is:</p>
  
  <pre><code> (
      {
        ID="1",
      }
      {
        ID="2",
      }
      {
        ID="3",
      }
      {
        ID="",
      }
      )
  </code></pre>
  
  <p>I could not see the last value.How can I get all the items ?</p>