Guest User

Untitled

a guest
May 24th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
  3. <?xml-stylesheet type="text/xsl" href="rss.xsl"?>
  4. <channel>
  5. <title>MyRSS</title>
  6. <atom:link href="http://www.example.com/rss.php" rel="self" type="application/rss+xml" />
  7. <link>http://www.example.com/rss.php</link>
  8. <description>MyRSS</description>
  9. <language>en-us</language>
  10. <pubDate>Tue, 22 May 2018 13:15:15 +0530</pubDate>
  11. <item>
  12. <title>Title 1</title>
  13. <pubDate>Tue, 22 May 2018 13:14:40 +0530</pubDate>
  14. <link>http://www.example.com/news.php?nid=47610</link>
  15. <guid>http://www.example.com/news.php?nid=47610</guid>
  16. <description>bla bla bla</description>
  17. </item>
  18. </channel>
  19. </rss>
  20.  
  21. VTDGen vg = new VTDGen();
  22. if (vg.parseHttpUrl(appDataBean.getUrl(), true)) {
  23. VTDNav vn = vg.getNav();
  24. AutoPilot ap = new AutoPilot(vn);
  25. ap.selectXPath("/channel/item");
  26. int result = -1;
  27.  
  28. while ((result = ap.evalXPath()) != -1) {
  29. if (vn.matchElement("item")) {
  30. do {
  31. //do something with the contnets in the item node
  32. Log.d("VTD", vn.toString(vn.getText()));
  33. } while (vn.toElement(VTDNav.NEXT_SIBLING));
  34. }
  35. }
  36. }
Add Comment
Please, Sign In to add comment