Hello,
I'm making an android client for a web site. my app have to go through the website, parse HTML, post some forms, send HTTP requests etc.
What library covering all this stuff you recommand me to use ?
thanks.
Hello,
I'm making an android client for a web site. my app have to go through the website, parse HTML, post some forms, send HTTP requests etc.
What library covering all this stuff you recommand me to use ?
thanks.
Using HttpURLConnection
make a server call . Open the connection get the stream.
For parsing HTML tags you can go with XMLPullParser
available in Android. You should be able to read HTML tags from it.
HttpClient should be good. And parsing can be done using XMLPullParser
Here is another approach to Using XPATH and HTML Cleaner to parse HTML / XML
I also read here that Jericho HTML Parser works well on Android. it works very efficiently in Android, and has a pretty comprehensive API. There are examples on the site, but to give you an idea of the syntax:
Source source = new Source(new URL("www.google.co.uk"));
List<Element> linkElements = source.getAllElements(HTMLElementName.A);
for (Element linkElement : linkElements) {
String href = linkElement.getAttributeValue("href");
if (href != null) {
System.out.println(href);
}
}
To add third-party libraries into an Android project, you don't link them like you would in Java - you have to extract them into your project. See here:
http://stackoverflow.com/questions/1334802/how-can-i-use-external-jars-in-an-android-project
Here is HttpClient tutorial: http://hc.apache.org/httpcomponents-client/tutorial/html/