title: Parsing deep XML structure using RESTKit
body: <p>I am sold on RESTKit's potential -- it sounds awesome.</p>
  
  <p>Unfortunately, all of the examples I've been able to find revolve around parsing JSON, and parsing relatively "flat" JSON at that.  The unfortunately reality of the world is that there's lots of XML, and a lot of it is ugly.</p>
  
  <p>Particularly, I cannot seem to find any good examples of parsing a deeply nested XML structure.</p>
  
  <p>I think my failing is in understanding key paths, and I'm hoping the answer to this question will become a canonical example for others who are facing this problem.</p>
  
  <p>Let's go with a contrived example.  Consider the following XML:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt; 
  &lt;old_lady fate="perhaps she'll die!"&gt; 
    &lt;bird reason = "to catch the spider"&gt; 
      &lt;spider reason="to catch the fly"&gt; 
        &lt;fly reason="why oh why?" action="swallowed" name="Al"/&gt; 
        &lt;fly reason="why oh why?" action="swallowed" name="Bob"/&gt; 
        &lt;fly reason="why oh why?" action="swallowed" name="Cory"/&gt; 
        &lt;fly reason="why oh why?" action="swallowed" name="Dan"/&gt; 
        &lt;fly reason="why oh why?" action="swallowed" name="Edgar"/&gt; 
      &lt;/spider&gt; 
    &lt;/bird&gt; 
  &lt;/old_lady&gt;
  </code></pre>
  
  <p>Let's say I want to get out of this a list of Fly objects:</p>
  
  <pre><code>@interface Fly : NSObject 
  @property (retain) NSString *reason; 
  @property (retain) NSString *action; 
  @property (retain) NSString *name; 
  @end 
  </code></pre>
  
  <p>So I had thought I'd do something like this:</p>
  
  <pre><code>[RKObjectManager objectManagerWithBaseURL:[NSURL 
  URLWithString:@"http://some.server.com"]];
  
  RKObjectMapping *mapping = [RKObjectMapping mappingForClass:[Fly class]]; 
  [mapping mapKeyPath:@"reason" toAttribute:@"reason"]; 
  [mapping mapKeyPath:@"action" toAttribute:@"action"]; 
  [mapping mapKeyPath:@"name" toAttribute:@"name"];
  
  [RKObjectManager.sharedManager.mappingProvider setMapping:mapping
  forKeyPath:@"//old_lady/bird/spider/fly"]; 
  
  [[RKObjectManager sharedManager] loadObjectsAtResourcePath:@"/path/to/rhyme.xml" 
                                                    delegate:self]; 
  </code></pre>
  
  <p>However, this gets me: </p>
  
  <pre><code>Encountered errors during mapping: Could not find an object mapping for keyPath: '' 
  </code></pre>
  
  <p>I'm sure the problem is my '//old_lady/bird/spider/fly' key path, but I just can't find any similar examples to model a solution after.  Halp? </p>