#4 How to process data part 2 : android xml parser tutorials

#4 How to process data part 2 : android xml parser tutorials



How to process data part 2 : android xml parser tutorials
this tutorial is for processing data fetched from rss feeds
Download Source Code from here :
http://www.loopwiki.com/application/android-rss-feed-reader-application/

My website:
http://www.loopwiki.com

we are social:
Facebook:
https://www.facebook.com/LoopWiki/

Google+
https://plus.google.com/118179389542279042467

Instagram :
https://www.instagram.com/bit_coder/

Transcription:
In this class we will store title,pubDate,Link, Description,Thaumbnil url etc . So create all string objects of title, link ,Description,Thaumbnil url etc . to create getters and setters press alt insert and select all methodes and insert them.
Now go to ReadRss class and remove log statement from our previous programm. Now for every item we will create new FeedItem . So create New FeedItem under if condition of item and name it as item.
Now under 2nd for loop we will check our node is title node using if condition. if our node is title node, then we will set title of item as textcontent of our current node . we will do same for all the other description , pubDate and link node.
Now we have to store every item in single item. to do this we will use arraylist .
ArrayList class uses a dynamic array for storing the elements.
.Create new Arraylist of feedItems . Name it as feeditems. Now below 2nd for loop add this item into feedItems arryList. Now create Log statements that will print string data stored in items.
enter tag names as shown in tutorial. Now we done with processing of data . hit run on the top .
here my app is running . Open logcat and search for item .
here we get all title,date,description etc. in good format .
this concludes that we successfully Processed data .
In the next tutorial we will take a look at recyclerview. in the mean time like,share , comment and dont forget to subscribe my channel . thank you have a nice day

source

8 comments

  1. Thanks for the great tutorials. I have one question. I like to get the url for the image which is inside <p><a href=" which is inside <content>. How can i get the image url? Heres an example:
    <item>
    <title>Star Wars поставува нов рекорд</title>
    <link>http://triagolnik.com/star-wars-postavuva-nov-rekord/</link>
    <comments>http://triagolnik.com/star-wars-postavuva-nov-rekord/#respond</comments>
    <pubDate>Thu, 17 Mar 2016 17:37:15 +0000</pubDate>
    <dc:creator><![CDATA[admin]]></dc:creator>
    <category><![CDATA[Свет]]></category>
    <category><![CDATA[Случувања]]></category>
    <guid isPermaLink="false">http://triagolnik.com/?p=3568</guid>
    <description><![CDATA[Компанијата Волт Дизни (Walt Disney), вчера објави дека нејзиниот блокбастер „Војна на ѕвездите: силата се буди“ остварил заработка од 1 милајарда долари, за само 12 дена. Со ова, „Војна на ѕвездите“ го собори рекордот на „Светот на Јура“, кој во текот на Јуни оствари заработка од 1 милијарда долари, за само 13 дена. Само за [&#8230;]]]></description>
    <content:encoded><![CDATA[<p>Компанијата Волт Дизни (Walt Disney), вчера објави дека нејзиниот блокбастер „Војна на ѕвездите: силата се буди“ остварил заработка од 1 милајарда долари, за само 12 дена.</p>
    <p><a href="http://triagolnik.com/wp-content/uploads/2016/03/star-wars.jpg" rel="attachment wp-att-3569"><img class="aligncenter size-large wp-image-3569" src="http://triagolnik.com/wp-content/uploads/2016/03/star-wars-1024×683.jpg" alt="star wars" width="960" height="640" srcset="http://triagolnik.com/wp-content/uploads/2016/03/star-wars-300×200.jpg 300w, http://triagolnik.com/wp-content/uploads/2016/03/star-wars-768×512.jpg 768w, http://triagolnik.com/wp-content/uploads/2016/03/star-wars-1024×683.jpg 1024w, http://triagolnik.com/wp-content/uploads/2016/03/star-wars.jpg 1280w" sizes="(max-width: 960px) 100vw, 960px" /></a></p>
    <p>Со ова, „Војна на ѕвездите“ го собори рекордот на „Светот на Јура“, кој во текот на Јуни оствари заработка од 1 милијарда долари, за само 13 дена.<br />
    Само за споредба, претходното седмо продолжение имаше вкупна заработка од 544.5 милиони долари. Светската доминација на „Војна на ѕвездите: силата се буди“ e далеку од завршена, со оглед дека неговото прикажување во Кина која е втор најголем филмски пазар, започнува дури на 9-ти Јануари следната година.</p>
    <p><a class="a2a_button_facebook" href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Ftriagolnik.com%2Fstar-wars-postavuva-nov-rekord%2F&amp;linkname=Star%20Wars%20%D0%BF%D0%BE%D1%81%D1%82%D0%B0%D0%B2%D1%83%D0%B2%D0%B0%20%D0%BD%D0%BE%D0%B2%20%D1%80%D0%B5%D0%BA%D0%BE%D1%80%D0%B4" title="Facebook" rel="nofollow" target="_blank"></a><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Ftriagolnik.com%2Fstar-wars-postavuva-nov-rekord%2F&amp;linkname=Star%20Wars%20%D0%BF%D0%BE%D1%81%D1%82%D0%B0%D0%B2%D1%83%D0%B2%D0%B0%20%D0%BD%D0%BE%D0%B2%20%D1%80%D0%B5%D0%BA%D0%BE%D1%80%D0%B4" title="Twitter" rel="nofollow" target="_blank"></a><a class="a2a_button_google_plus" href="http://www.addtoany.com/add_to/google_plus?linkurl=http%3A%2F%2Ftriagolnik.com%2Fstar-wars-postavuva-nov-rekord%2F&amp;linkname=Star%20Wars%20%D0%BF%D0%BE%D1%81%D1%82%D0%B0%D0%B2%D1%83%D0%B2%D0%B0%20%D0%BD%D0%BE%D0%B2%20%D1%80%D0%B5%D0%BA%D0%BE%D1%80%D0%B4" title="Google+" rel="nofollow" target="_blank"></a><a class="a2a_dd a2a_target addtoany_share_save" href="https://www.addtoany.com/share#url=http%3A%2F%2Ftriagolnik.com%2Fstar-wars-postavuva-nov-rekord%2F&amp;title=Star%20Wars%20%D0%BF%D0%BE%D1%81%D1%82%D0%B0%D0%B2%D1%83%D0%B2%D0%B0%20%D0%BD%D0%BE%D0%B2%20%D1%80%D0%B5%D0%BA%D0%BE%D1%80%D0%B4" id="wpa2a_6"></a></p>]]></content:encoded>
    <wfw:commentRss>http://triagolnik.com/star-wars-postavuva-nov-rekord/feed/</wfw:commentRss>
    <slash:comments>0</slash:comments>
    </item>

  2. when I run my code it stops also I looked at your code and you have type cureent instead of current on all your (cureent.getNodeName) am i missing something

  3. In itemDescription I'm getting feeds like this (<p>&#160; &#160; Entrepreneurs are often dedicated to the companies they set up and hence are immersed in their jobs. Since the workload is hectic, they…</p>) from a news website I'm using, i.e they are coming with html/css tags, How do I remove them.

Comments are closed.