![]() Registered Member ![]()
|
Hello
![]() I've just started developing a plasmoid in java script and have some questions. My goal is to load xml-data from a remote url, parse it, and print out the results in my plasmoid. Until yet I've only managed to access the remote url via this:
My first question: How can I access the returned data? I don't understand the information concerning IOJob in the API. I cant really be writing:
?! Oh and concening the parsing, I read that ECMA-Scripts doesn't support DOM-Functionality so I have to switch to using something like xml_for_scripts. Am I mistaken? I hope someone could help me with these 2 questions ![]() Sunny |
![]() Administrator ![]()
|
Please see http://techbase.kde.org/Development/Tut ... /API#IOJob
You should connect to the data(IOJob job, ByteArray data) and finished(IOJob job) Signals, and perform the XML parsing in appropriate connected slots.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
![]() Registered Member ![]()
|
well, this doesn't help much. As I already said, I don't understand the information in the api concerning IOjob...
It would be nice if u could give an example. - I know that I have to use the data function and finished function - but I'd like to see how! On which object do i call the data / finished function.. And what "appropriate connected slots" are u talking about? Please be more precise!! |
![]() Administrator ![]()
|
The IOJob API is a wrapper around the KDE KJob API, which is async. This means that the plasmoid.getUrl() call you make will return immediately, rather than after the request is completed.
To allow you to access the returned data, the getUrl() call returns an instance of IOJob, which will emit several signals when certain stages of the operation have been reached. I would recommend reading http://doc.trolltech.com/4.6/signalsandslots.html for further information on how signals and slots ( your local functions for handling the data ) work. In essence, you need to connect the signals of the IOJob to the "slots" ( or functions ) of your plasmoid.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
Registered users: Bing [Bot], Google [Bot], Sogou [Bot]