What is the best way to clear this HTML for an Android app?

What is the best way to clear below HTML from a webpage? I want to pull out Apple, Orange and Grape and put them in a drop-down menu in an Android app. Should I use Jsoup for this, and if so, what would be the best way to do this? Should I use Regex instead?

<select name="fruit" id="fruit" >
<option value="APPLE">Apple</option>
<option value="ORANGE">Orange</option>
<option value="GRAPE">Grape</option>
</select>
+5
source share
3 answers

Depends, but I would go with an XML / HTML parser. Do not use regex .

Example with jsoup :

Document doc = Jsoup.connect(someUrl).get();
Elements options = doc.select("select#fruit option");

Learn more about jsoup selector syntax .


The best way?

DOM, SAX. , SAX . , . SAX vs DOM.

+14

HTML jsoup. , API .

http://jsoup.org/

!

EDIT: : D skyuzo :)

+2

WebView - :

http://developer.android.com/reference/android/webkit/WebView.html

html , . , javascript, , html - ajax js :)

+1
source

All Articles