This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Html parsing etc in javascript plasmoid?

Tags: None
(comma "," separated)
aabbqrstp
Registered Member
Posts
13
Karma
0
OS
What I want to do is to load a webpage (an online dictionary), find a special element (the part containing the translation/description), cut it out and then run a few regexes on that.

So I guess what I need is some way of getting the inner html of an object on a webpage based on its id or xpath.
If I were in a browser I could just use getElementById or something similar but here...

Any ideas? Some library I could use?
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
You should be able to use Qt's QWeb* API's to achieve this, or potentially QDomDocument.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
aabbqrstp
Registered Member
Posts
13
Karma
0
OS
Thank you.
But how do I access those from my javascript plasmoid?
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
I am not sure if the appropriate API's are exposed via Javascript. With C++ at least, you can have a look at the Web Slice applet to see how it renders sections of a page.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
aabbqrstp
Registered Member
Posts
13
Karma
0
OS
Ok, thanks for your help.
I don't think they are exposed, tried to use them before and it didn't work.
Guess I have to change to C++.


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot], rockscient