android - Read html inside XML feed using XmlPullParser -
how read html contents inside xml,using xlpullparser in android project.
ex:what's inside in facebook feed.
note:it may contains images, albums, videos...
update:i need parse content of ![cdata[
on vogella.com, there nice example on how use xmlpullparser.
import java.io.ioexception; import java.io.stringreader; import org.xmlpull.v1.xmlpullparser; import org.xmlpull.v1.xmlpullparserexception.html; import org.xmlpull.v1.xmlpullparserfactory; public class simplexmlpullapp { public static void main (string args[]) throws xmlpullparserexception, ioexception { xmlpullparserfactory factory = xmlpullparserfactory.newinstance(); factory.setnamespaceaware(true); xmlpullparser xpp = factory.newpullparser(); xpp.setinput(new stringreader ("<foo>hello world!</foo>")); int eventtype = xpp.geteventtype(); while (eventtype != xmlpullparser.end_document) { if(eventtype == xmlpullparser.start_document) { system.out.println("start document"); } else if(eventtype == xmlpullparser.end_document) { system.out.println("end document"); } else if(eventtype == xmlpullparser.start_tag) { system.out.println("start tag "+xpp.getname()); } else if(eventtype == xmlpullparser.end_tag) { system.out.println("end tag "+xpp.getname()); } else if(eventtype == xmlpullparser.text) { system.out.println("text "+xpp.gettext()); } eventtype = xpp.next(); } } }
Comments
Post a Comment