title: Parsing image from XML Content
body: <p>I am using  <a href="https://github.com/gcharita/XMLMapper" rel="nofollow noreferrer">XMLMapper</a> for mapping XML response. Below is a few lines from the response I am getting from API URL,</p>
  <pre><code>&lt;feed xmlns:im=&quot;http://itunes.apple.com/rss&quot; xmlns=&quot;http://www.w3.org/2005/Atom&quot; xml:lang=&quot;en&quot;&gt;
  &lt;id&gt;http://mzstoreservices-int.dslb.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/topsongs/limit=25/xml&lt;/id&gt;
  &lt;title&gt;iTunes Store: Top Songs&lt;/title&gt;
  &lt;updated&gt;2021-04-06T19:18:54-07:00&lt;/updated&gt;
  &lt;link rel=&quot;alternate&quot; type=&quot;text/html&quot; href=&quot;https://itunes.apple.com/WebObjects/MZStore.woa/wa/viewTop?cc=us&amp;id=1&amp;popId=1&quot;/&gt;
  &lt;link rel=&quot;self&quot; href=&quot;http://mzstoreservices-int.dslb.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/topsongs/limit=25/xml&quot;/&gt;
  &lt;icon&gt;http://itunes.apple.com/favicon.ico&lt;/icon&gt;
  &lt;author&gt;
  &lt;name&gt;iTunes Store&lt;/name&gt;
  &lt;uri&gt;http://www.apple.com/itunes/&lt;/uri&gt;
  &lt;/author&gt;
  &lt;rights&gt;Copyright 2008 Apple Inc.&lt;/rights&gt;
  &lt;entry&gt;
  &lt;updated&gt;2021-04-06T19:18:54-07:00&lt;/updated&gt;
  &lt;id im:id=&quot;1547525311&quot;&gt;https://music.apple.com/us/album/astronaut-in-the-ocean/1547525310?i=1547525311&amp;uo=2&lt;/id&gt;
  &lt;title&gt;Astronaut In The Ocean - Masked Wolf&lt;/title&gt;
  &lt;im:name&gt;Astronaut In The Ocean&lt;/im:name&gt;
  &lt;link rel=&quot;alternate&quot; type=&quot;text/html&quot; href=&quot;https://music.apple.com/us/album/astronaut-in-the-ocean/1547525310?i=1547525311&amp;uo=2&quot;/&gt;
  &lt;im:contentType term=&quot;Music&quot; label=&quot;Music&quot;&gt;
  &lt;im:contentType term=&quot;Track&quot; label=&quot;Track&quot;/&gt;
  &lt;/im:contentType&gt;
  &lt;category im:id=&quot;18&quot; term=&quot;Hip Hop/Rap&quot; scheme=&quot;https://music.apple.com/us/genre/music-hip-hop-rap/id18?uo=2&quot; label=&quot;Hip-Hop/Rap&quot;/&gt;
  &lt;link title=&quot;Preview&quot; rel=&quot;enclosure&quot; type=&quot;audio/x-m4a&quot; href=&quot;https://audio-ssl.itunes.apple.com/itunes-assets/AudioPreview124/v4/81/b4/95/81b495ac-0475-928b-8a27-a4fe2682749b/mzaf_17183909416838915149.plus.aac.p.m4a&quot; im:assetType=&quot;preview&quot;&gt;
  &lt;im:duration&gt;30000&lt;/im:duration&gt;
  &lt;/link&gt;
  &lt;im:artist href=&quot;https://music.apple.com/us/artist/masked-wolf/1313094981?uo=2&quot;&gt;Masked Wolf&lt;/im:artist&gt;
  &lt;im:price amount=&quot;1.29000&quot; currency=&quot;USD&quot;&gt;$1.29&lt;/im:price&gt;
  &lt;im:image height=&quot;55&quot;&gt;https://is4-ssl.mzstatic.com/image/thumb/Music124/v4/af/ef/ff/afefff15-b936-3cb7-9101-166f8501e71a/075679793102.jpg/55x55bb.png&lt;/im:image&gt;
  &lt;im:image height=&quot;60&quot;&gt;https://is3-ssl.mzstatic.com/image/thumb/Music124/v4/af/ef/ff/afefff15-b936-3cb7-9101-166f8501e71a/075679793102.jpg/60x60bb.png&lt;/im:image&gt;
  &lt;im:image height=&quot;170&quot;&gt;https://is1-ssl.mzstatic.com/image/thumb/Music124/v4/af/ef/ff/afefff15-b936-3cb7-9101-166f8501e71a/075679793102.jpg/170x170bb.png&lt;/im:image&gt;
  &lt;rights&gt;℗ 2021 Elektra Records LLC&lt;/rights&gt;
  &lt;im:releaseDate label=&quot;June 7, 2019&quot;&gt;2019-06-07T05:00:00-07:00&lt;/im:releaseDate&gt;
  &lt;im:collection&gt;
  &lt;im:name&gt;Astronaut In The Ocean - Single&lt;/im:name&gt;
  &lt;link rel=&quot;alternate&quot; type=&quot;text/html&quot; href=&quot;https://music.apple.com/us/album/astronaut-in-the-ocean-single/1547525310?uo=2&quot;/&gt;
  &lt;im:contentType term=&quot;Music&quot; label=&quot;Music&quot;&gt;
  &lt;im:contentType term=&quot;Album&quot; label=&quot;Album&quot;/&gt;
  &lt;/im:contentType&gt;
  &lt;/im:collection&gt;
  &lt;content type=&quot;html&quot;&gt;&lt;table border=&quot;0&quot; width=&quot;100%&quot;&gt; &lt;tr&gt; &lt;td&gt; &lt;table border=&quot;0&quot; width=&quot;100%&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt; &lt;tr valign=&quot;top&quot; align=&quot;left&quot;&gt; &lt;td align=&quot;center&quot; width=&quot;166&quot; valign=&quot;top&quot;&gt; &lt;a href=&quot;https://music.apple.com/us/album/astronaut-in-the-ocean/1547525310?i=1547525311&amp;uo=2&quot;&gt;&lt;img border=&quot;0&quot; alt=&quot;Masked Wolf - Astronaut In The Ocean artwork&quot; src=&quot;https://is1-ssl.mzstatic.com/image/thumb/Music124/v4/af/ef/ff/afefff15-b936-3cb7-9101-166f8501e71a/075679793102.jpg/100x100bb.png&quot; /&gt;&lt;/a&gt; &lt;/td&gt; &lt;td width=&quot;10&quot;&gt;&lt;img alt=&quot;&quot; width=&quot;10&quot; height=&quot;1&quot; src=&quot;http://r.mzstatic.com/images/spacer.gif&quot; /&gt;&lt;/td&gt; &lt;td width=&quot;95%&quot;&gt; &lt;b&gt;&lt;a href=&quot;https://music.apple.com/us/album/astronaut-in-the-ocean/1547525310?i=1547525311&amp;uo=2&quot;&gt;Astronaut In The Ocean&lt;/a&gt;&lt;/b&gt;&lt;br/&gt; &lt;a href=&quot;https://music.apple.com/us/album/astronaut-in-the-ocean-single/1547525310?uo=2&quot;&gt;Astronaut In The Ocean - Single&lt;/a&gt;&lt;br/&gt; &lt;a href=&quot;https://music.apple.com/us/artist/masked-wolf/1313094981?uo=2&quot;&gt;Masked Wolf&lt;/a&gt; &lt;font size=&quot;2&quot; face=&quot;Helvetica,Arial,Geneva,Swiss,SunSans-Regular&quot;&gt; &lt;br/&gt; &lt;b&gt;Genre:&lt;/b&gt; &lt;a href=&quot;https://music.apple.com/us/genre/music-hip-hop-rap/id18?uo=2&quot;&gt;Hip-Hop/Rap&lt;/a&gt; &lt;br/&gt; &lt;b&gt;Price:&lt;/b&gt; $1.29 &lt;br/&gt; &lt;b&gt;Release Date:&lt;/b&gt; June 7, 2019 &lt;/font&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;font size=&quot;2&quot; face=&quot;Helvetica,Arial,Geneva,Swiss,SunSans-Regular&quot;&gt; &amp;#169; ℗ 2021 Elektra Records LLC&lt;/font&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/content&gt;
  &lt;/entry&gt;
  </code></pre>
  <p>Used <a href="https://github.com/Alamofire/Alamofire" rel="nofollow noreferrer">Almofire</a> for calling api,</p>
  <pre><code>import Alamofire
  import XMLMapper
  
  func fetchData() {
          AF.request(URL(string: &quot;http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/topsongs/limit=20/xml&quot;)!, method: .get, parameters: [:], encoding: URLEncoding.default, headers: []).responseData { (response) in
          do{
                let xmlDictionary = try XMLSerialization.xmlObject(with: response.data!) as? [String: Any]
                 print(xmlDictionary!)
                 let rssFeed = XMLMapper&lt;SongFeed&gt;().map(XMLObject: xmlDictionary)
                 print(rssFeed?.entry?[0].image ?? &quot;&quot;)
            } catch {
                 print(&quot;Serialization error occurred: \(error.localizedDescription)&quot;)
            }
      }
  }
  </code></pre>
  <p>Here is my model class,</p>
  <pre><code>import XMLMapper
  
  class SongFeed : XMLMappable {
      var nodeName: String!
      var title : String?
      var entry : [Entry]?
      
      required init?(map: XMLMap) {
      }
  
      func mapping(map: XMLMap) {
          title &lt;- map[&quot;title&quot;]
          entry &lt;- map[&quot;entry&quot;]
      }
  }
  
  class Entry : XMLMappable {
      var nodeName: String!
      var title : String?
      var link: URL?
      var image : URL?
      var name : String?
      
      required init?(map: XMLMap) {
      }
      
      func mapping(map: XMLMap) {
          title &lt;- map[&quot;title&quot;]
          link &lt;- (map[&quot;link&quot;], XMLURLTransform())
          image &lt;- (map[&quot;im:image&quot;], XMLURLTransform())
          name &lt;- map[&quot;im:name&quot;]
      }
  }
  </code></pre>
  <p>I am unable to fetch image URL from the &lt;im:image&gt; tag from the XML response. Also I am confused as there are three &lt;im:image&gt; tags with different height parameters, how can I fetch one of them? Can anyone help?</p>