I have have good results with Jericho (http://jericho.htmlparser.net),
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
On Thu, Mar 4, 2010 at 7:22 AM, Beena <[email protected]> wrote:
> second thing how can I use it?
>
> It showing me all the packages.
>
> Then how can I parse it?
> Any sample code will help a lot.
>
> Thanks.
>
> On Mar 4, 12:06 pm, Beena <[email protected]> wrote:
>> Thanks Jens,
>>
>> I have to parse HTML in my project.
>>
>> I have set the tagsoup-1.2.jar file using eclips.
>> Now when I build it gives warning as
>> warning: Ignoring InnerClasses attribute for an anonymous inner class
>> that doesn't come with an associated EnclosingMethod attribute. (This
>> class was probably produced by a broken compiler.)
>>
>> All the parser giving same warning.
>>
>> Please reply.
>>
>> Its urgent.
>>
>> On Feb 24, 1:23 pm, Jens <[email protected]> wrote:
>>
>> > Tagsoup. You can add the lib to your project or (ab)use reflection to
>> > obtain it from your platform - Google is using themselves.
>>
>> >http://home.ccil.org/~cowan/XML/tagsoup/
>>
>> > On 22 Feb, 06:54, Alisha <[email protected]> wrote:
>>
>> > > Hi All,
>>
>> > > I have to parse a html file using java. I have gone through a lot of
>> > > html parsers, but seem to understand none of them. So please help me
>> > > out with the type of parser that should be used for an android app and
>> > > how to parse a html file.
>>
>>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en