private boolean handleNode ( String tag , Article article ) { try { if ( xmlParser . next ( ) != XmlPullParser . TEXT ) return false ; if ( tag . equalsIgnoreCase ( "link" ) ) article . setSource ( Uri . parse ( xmlParser . getText ( ) ) ) ; else if ( tag . equalsIgnoreCase ( "title" ) ) article . setTitle ( xmlParser . getText ( ) ) ; else if ( tag . equalsIgnoreCase ( "description" ) ) { String encoded = xmlParser . getText ( ) ; article . setImage ( Uri . parse ( pullImageLink ( encoded ) ) ) ; article . setDescription ( Html . fromHtml ( encoded . replaceAll ( "<img.+?>" , "" ) ) . toString ( ) ) ; } else if ( tag . equalsIgnoreCase ( "content:encoded" ) ) article . setContent ( xmlParser . getText ( ) . replaceAll ( "[<](/)?div[^>]*[>]" , "" ) ) ; else if ( tag . equalsIgnoreCase ( "wfw:commentRss" ) ) article . setComments ( xmlParser . getText ( ) ) ; else if ( tag . equalsIgnoreCase ( "category" ) ) article . setNewTag ( xmlParser . getText ( ) ) ; else if ( tag . equalsIgnoreCase ( "dc:creator" ) ) article . setAuthor ( xmlParser . getText ( ) ) ; else if ( tag . equalsIgnoreCase ( "pubDate" ) ) { article . setDate ( getParsedDate ( xmlParser . getText ( ) ) ) ; } return true ; } catch ( IOException e ) { e . printStackTrace ( ) ; return false ; } catch ( XmlPullParserException e ) { e . printStackTrace ( ) ; return false ; } }
Handles a node from the tag node and assigns it to the correct article value .