title: parse xml using touch xml
body: <p>i am new to xml and want to parse it by using touch xml.</p>
  
  <pre><code>&lt;?xml version="1.0" standalone="yes"?&gt;
  &lt;DataSetMenu xmlns="http://tempuri.org/DataSetMenu.xsd"&gt;
    &lt;MenuCategories&gt;
      &lt;MenuCatID&gt;10108&lt;/MenuCatID&gt;
      &lt;MenuCatName&gt;SPEICALS&lt;/MenuCatName&gt;
      &lt;BusinessEntityID&gt;20137&lt;/BusinessEntityID&gt;
      &lt;DisplayIndex&gt;0&lt;/DisplayIndex&gt;
      &lt;MenuCatDesc /&gt;
      &lt;Visible&gt;true&lt;/Visible&gt;
      &lt;ImagePath /&gt;
    &lt;/MenuCategories&gt;
    &lt;MenuCategories&gt;
      &lt;MenuCatID&gt;10109&lt;/MenuCatID&gt;
      &lt;MenuCatName&gt;GENERAL MENU&lt;/MenuCatName&gt;
      &lt;BusinessEntityID&gt;20137&lt;/BusinessEntityID&gt;
      &lt;DisplayIndex&gt;1&lt;/DisplayIndex&gt;
      &lt;MenuCatDesc /&gt;
      &lt;Visible&gt;true&lt;/Visible&gt;
      &lt;ImagePath /&gt;
    &lt;/MenuCategories&gt;
    &lt;MenuGroups&gt;
  
      &lt;MenuGroupID&gt;110079&lt;/MenuGroupID&gt;
      &lt;MenuCatID&gt;10108&lt;/MenuCatID&gt;
      &lt;MenuGroupName&gt;PIZZA&amp;amp;WINGS&amp;amp;DRINK DEAL&lt;/MenuGroupName&gt;
      &lt;MenuGroupDesc /&gt;
      &lt;Visible&gt;true&lt;/Visible&gt;
      &lt;DisplayIndex&gt;0&lt;/DisplayIndex&gt;
      &lt;MenuTypeID&gt;1&lt;/MenuTypeID&gt;
      &lt;ImagePath /&gt;
      &lt;ServiceTimeEnforced&gt;false&lt;/ServiceTimeEnforced&gt;
      &lt;ServiceStartTime&gt;2013-04-15T11:00:00-05:00&lt;/ServiceStartTime&gt;
      &lt;ServiceEndTime&gt;2013-04-15T15:00:00-05:00&lt;/ServiceEndTime&gt;
      &lt;Monday&gt;true&lt;/Monday&gt;
      &lt;Tuesday&gt;true&lt;/Tuesday&gt;
      &lt;Wednesday&gt;true&lt;/Wednesday&gt;
      &lt;Thursday&gt;true&lt;/Thursday&gt;
      &lt;Friday&gt;true&lt;/Friday&gt;
      &lt;Saturday&gt;true&lt;/Saturday&gt;
      &lt;Sunday&gt;true&lt;/Sunday&gt;
    &lt;/MenuGroups&gt;
    &lt;MenuGroups&gt;
      &lt;MenuGroupID&gt;110081&lt;/MenuGroupID&gt;
      &lt;MenuCatID&gt;10109&lt;/MenuCatID&gt;
      &lt;MenuGroupName&gt;BUILD YOUR OWN PIZZA&lt;/MenuGroupName&gt;
      &lt;MenuGroupDesc /&gt;
      &lt;Visible&gt;true&lt;/Visible&gt;
      &lt;DisplayIndex&gt;0&lt;/DisplayIndex&gt;
      &lt;MenuTypeID&gt;1&lt;/MenuTypeID&gt;
      &lt;ImagePath /&gt;
      &lt;ServiceTimeEnforced&gt;false&lt;/ServiceTimeEnforced&gt;
      &lt;ServiceStartTime&gt;1900-01-01T11:00:00-06:00&lt;/ServiceStartTime&gt;
      &lt;ServiceEndTime&gt;1900-01-01T15:00:00-06:00&lt;/ServiceEndTime&gt;
      &lt;Monday&gt;true&lt;/Monday&gt;
      &lt;Tuesday&gt;true&lt;/Tuesday&gt;
      &lt;Wednesday&gt;true&lt;/Wednesday&gt;
      &lt;Thursday&gt;true&lt;/Thursday&gt;
      &lt;Friday&gt;true&lt;/Friday&gt;
      &lt;Saturday&gt;true&lt;/Saturday&gt;
      &lt;Sunday&gt;true&lt;/Sunday&gt;
    &lt;/MenuGroups&gt;
  </code></pre>
  
  <p>i am trying to use this code </p>
  
  <pre><code>//  we will put parsed data in an a array
      NSMutableArray *res = [[NSMutableArray alloc] init];
  
      //  using local resource file
      NSString *XMLPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"20137_ZZ Pizza &amp; Kabob_2013_04_19 01_20_22_Local.xml"];
      NSData *XMLData   = [NSData dataWithContentsOfFile:XMLPath];
      CXMLDocument *doc = [[[CXMLDocument alloc] initWithData:XMLData options:0 error:nil] autorelease];
  
      NSArray *nodes = NULL;
      //  searching for piglet nodes
      nodes = [doc nodesForXPath:@"//MenuCatID" error:nil];
  
      for (CXMLElement *node in nodes) {
          NSMutableDictionary *item = [[NSMutableDictionary alloc] init];
          int counter;
          for(counter = 0; counter &lt; [node childCount]; counter++) {
              //  common procedure: dictionary with keys/values from XML node
              [item setObject:[[node childAtIndex:counter] stringValue] forKey:[[node childAtIndex:counter] name]];
          }
  
          //  and here it is - attributeForName! Simple as that.
          [item setObject:[[node attributeForName:@"id"] stringValue] forKey:@"id"];  // &lt;------ this magical arrow is pointing to the area of interest
  
          [res addObject:item];
          [item release];
      }
  
      //  and we print our results
      NSLog(@"%@", res);
      [res release];
  </code></pre>