public static ArtistDetailed getArtistInfoFromXml(XmlTag artistTag) {
    if (artistTag == null) {
      return null;
    }

    String name = artistTag.getChildByNameValue("name");
    if (name != null) name = Html.fromHtml(name).toString();
    String mbid = artistTag.getChildByNameValue("mbid");
    String url = artistTag.getChildByNameValue("url");
    //    String imageSmall = artistTag.getChildByNameAndAttributeValue("image", "size", "small");
    //    String imageMedium = artistTag.getChildByNameAndAttributeValue("image", "size", "medium");
    //    String imageLarge = artistTag.getChildByNameAndAttributeValue("image", "size", "large");
    //    String imageXLarge = artistTag.getChildByNameAndAttributeValue("image", "size",
    // "extralarge");
    //    String imageMega = artistTag.getChildByNameAndAttributeValue("image", "size", "mega");
    boolean streamable = "1".equals(artistTag.getChildByNameValue("streamable")) ? true : false;
    int listeners = 0;
    int plays = 0;
    try {
      listeners = Integer.parseInt(artistTag.getChildByNameValue("listeners"));
      plays = Integer.parseInt(artistTag.getChildByNameValue("plays"));
    } catch (NumberFormatException e) {
      //      Log.e(TAG, e.toString());
    } catch (NullPointerException e) {
      // do nothing
    }

    /** SIMILAR ARTISTS */
    XmlTag similarTag = artistTag.getChildByName("similar");

    List<Artist> similarArtists = getSimilarArtistsFromXml(similarTag);

    /** TAGS */
    XmlTag tagsTag = artistTag.getChildByName("tags");

    List<Tag> tags = new ArrayList<Tag>();
    if (tagsTag != null) {
      XmlTag singleTag = tagsTag.getChildByNameAvoidDuplicates("tag");
      while (singleTag != null) {
        Tag tag = getTagFromXml(singleTag);
        tags.add(tag);

        /** for next iteration * */
        singleTag = tagsTag.getChildByNameAvoidDuplicates("tag");
      }
    }

    XmlTag bioTag = artistTag.getChildByName("bio");
    Map<String, Object> bioMap = getWikiTextFromXml(bioTag);

    ArtistDetailed artistDetail =
        new ArtistDetailed(name, mbid, url, streamable, listeners, plays, similarArtists, tags);
    setImagesToAbstractInfoWithImages(artistDetail, artistTag);
    setWikiInfoToAbstractInfo(artistDetail, bioMap);
    //    artistDetail.setImages(imageSmall, imageMedium, imageLarge, imageXLarge, imageMega);

    return artistDetail;
  }
  /**
   * Create a Playlist object with tracks by parsing the xml.
   *
   * @param xml
   * @return Playlist with tracks from xml or null if xml is null.
   */
  public static Playlist getPlaylistFromXml(XmlTag playlistTag) {
    if (playlistTag == null) {
      return null;
    }

    String playlistTitle = playlistTag.getChildByNameValue("title");
    String playlistCreator = playlistTag.getChildByNameValue("creator");
    Date playlistDate = parseLastfmDate(playlistTag.getChildByNameValue("date"));

    int playlistExpiry = 0;
    try {
      playlistExpiry = Integer.parseInt(playlistTag.getChildByNameValue("link"));
    } catch (NumberFormatException e) {
      e.printStackTrace();
    }

    Playlist radioPlaylist =
        new Playlist(playlistTitle, playlistCreator, playlistDate, playlistExpiry);

    XmlTag tracks = playlistTag.getChildByName("trackList");
    XmlTag trackTag = tracks.getChildByNameAvoidDuplicates("track");
    while (trackTag != null) {
      String location = trackTag.getChildByNameValue("location");
      String title = trackTag.getChildByNameValue("title");
      String identifier = trackTag.getChildByNameValue("identifier");
      String album = trackTag.getChildByNameValue("album");
      String creator = trackTag.getChildByNameValue("creator");

      if (title != null) title = Html.fromHtml(title).toString();
      if (album != null) album = Html.fromHtml(album).toString();
      if (creator != null) creator = Html.fromHtml(creator).toString();

      int duration = 0;
      try {
        duration = Integer.parseInt(trackTag.getChildByNameValue("duration"));
      } catch (NumberFormatException e) {
        e.printStackTrace();
      }

      String image = trackTag.getChildByNameValue("image");

      RadioTrack track =
          new RadioTrack(location, title, identifier, album, creator, duration, image);
      radioPlaylist.addTrack(track);

      /** for next iteration * */
      trackTag = tracks.getChildByNameAvoidDuplicates("track");
    }

    return radioPlaylist;
  }
  public static List<Track> getTracksFromXml(XmlTag tracksTag) {
    List<Track> tracks = new ArrayList<Track>();
    if (tracksTag != null) {
      XmlTag singleTrack = tracksTag.getChildByNameAvoidDuplicates("track");
      while (singleTrack != null) {
        Track track = getTrackFromXml(singleTrack);
        tracks.add(track);

        /*
         * for next iteration
         */
        singleTrack = tracksTag.getChildByNameAvoidDuplicates("track");
      }
    }

    if (tracks.size() > 0) {
      return tracks;
    }
    return null;
  }
  public static List<Artist> getSimilarArtistsFromXml(XmlTag similarArtistsTag) {
    List<Artist> artists = new ArrayList<Artist>();

    if (similarArtistsTag != null) {
      XmlTag artistTag = similarArtistsTag.getChildByNameAvoidDuplicates("artist");
      while (artistTag != null) {
        Artist artist = LastfmXmlUtil.getSimilarArtistFromXml(artistTag);
        if (artist != null) {
          artists.add(artist);
        }
        artistTag = similarArtistsTag.getChildByNameAvoidDuplicates("artist");
      }
    }

    if (artists.size() > 0) {
      return artists;
    }

    return null;
  }
  public static List<Tag> getTagsFromXml(XmlTag tagsTag) {
    List<Tag> tags = new ArrayList<Tag>();
    if (tagsTag != null) {
      XmlTag singleTag = tagsTag.getChildByNameAvoidDuplicates("tag");
      while (singleTag != null) {
        Tag tag = getTagFromXml(singleTag);
        tags.add(tag);

        /*
         * for next iteration
         */
        singleTag = tagsTag.getChildByNameAvoidDuplicates("tag");
      }
    }

    if (tags.size() > 0) {
      return tags;
    }
    return null;
  }