0

I want to parse a HTML document in my Android project

I found many parsers and I want to use this HTML Parser
I really understand how it works and how I have to use it. But I'm not able to add the libraries right.

By adding the two jar-Files htmlparser.jar and htmllexxer.jar I get a compiling error:

Conversion to Dalvik format failed with error 1

I figured out that there's a conflict and so I added only one jar-file (the htmlparser.jar).

(btw. Internet connection is available) But the parsing throws me following exception:

08-15 20:58:45.662: ERROR/AndroidRuntime(386): FATAL EXCEPTION: main
08-15 20:58:45.662: ERROR/AndroidRuntime(386): java.lang.NoClassDefFoundError: org.htmlparser.Parser
08-15 20:58:45.662: ERROR/AndroidRuntime(386):     at com.mks_squadron.manager.communication.HTMLParser.parse(HTMLParser.java:15)
08-15 20:58:45.662: ERROR/AndroidRuntime(386):     at com.mks_squadron.manager.StartActivity$1.onClick(StartActivity.java:30)
08-15 20:58:45.662: ERROR/AndroidRuntime(386):     at android.view.View.performClick(View.java:2408)
08-15 20:58:45.662: ERROR/AndroidRuntime(386):     at android.view.View$PerformClick.run(View.java:8816)
08-15 20:58:45.662: ERROR/AndroidRuntime(386):     at android.os.Handler.handleCallback(Handler.java:587)
08-15 20:58:45.662: ERROR/AndroidRuntime(386):     at android.os.Handler.dispatchMessage(Handler.java:92)
08-15 20:58:45.662: ERROR/AndroidRuntime(386):     at android.os.Looper.loop(Looper.java:123)
08-15 20:58:45.662: ERROR/AndroidRuntime(386):     at android.app.ActivityThread.main(ActivityThread.java:4627)
08-15 20:58:45.662: ERROR/AndroidRuntime(386):     at java.lang.reflect.Method.invokeNative(Native Method)
08-15 20:58:45.662: ERROR/AndroidRuntime(386):     at java.lang.reflect.Method.invoke(Method.java:521)
08-15 20:58:45.662: ERROR/AndroidRuntime(386):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
08-15 20:58:45.662: ERROR/AndroidRuntime(386):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
08-15 20:58:45.662: ERROR/AndroidRuntime(386):     at dalvik.system.NativeStart.main(Native Method)

So I didn't import the jar-files right. What am I doing wrong? Could someone please help me, importing the libaries right? Thanks alot!

1 Answer 1

4

Those libraries may not be supported by Android. Also I would suspect you need both of the jars for it to work.

Try using JSoup. It's really easy to use and easy to get up and running on Android.

Sign up to request clarification or add additional context in comments.

1 Comment

yeah, I tested jsoup - MUCH easier to handle - THX!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.