@Override public void endElement(String uri, String localName, String qName) { if (localName.equalsIgnoreCase("image")) { if (!isItem) { isImage = false; } } else if (localName.equalsIgnoreCase("url")) { if (isImage) { feed.setLogo(StringEscapeUtils.unescapeXml(chars.toString())); } } else if (localName.equalsIgnoreCase("ttl")) { if (!isItem) { feed.setTtl(Integer.parseInt(StringEscapeUtils.unescapeXml(chars.toString()))); } } else if (localName.equalsIgnoreCase("title")) { if (!isImage) { if (isItem) { item.setTitle(StringEscapeUtils.unescapeXml(chars.toString())); } else { feed.setTitle(StringEscapeUtils.unescapeXml(chars.toString())); } } } else if (localName.equalsIgnoreCase("description")) { if (isItem) { item.setDescription(StringEscapeUtils.unescapeXml(chars.toString())); } else { feed.setDescription(StringEscapeUtils.unescapeXml(chars.toString())); } } else if (localName.equalsIgnoreCase("pubDate")) { if (isItem) { try { item.setDate(dateFormat.parse(StringEscapeUtils.unescapeXml(chars.toString()))); } catch (Exception e) { Log.e(LOG_CAT, "pubDate", e); } } else { try { feed.setDate(dateFormat.parse(StringEscapeUtils.unescapeXml(chars.toString()))); } catch (Exception e) { Log.e(LOG_CAT, "pubDate", e); } } } else if (localName.equalsIgnoreCase("item")) { isItem = false; } else if (localName.equalsIgnoreCase("link")) { if (isItem) { item.setLink(StringEscapeUtils.unescapeXml(chars.toString())); } else { feed.setLink(StringEscapeUtils.unescapeXml(chars.toString())); } } if (localName.equalsIgnoreCase("item")) {} }