Zimlet to get and parse XML file from HTTP server?

Interested in talking about Mash-up's? This is the place.
batfastad
Outstanding Member
Outstanding Member
Posts: 281
Joined: Fri Sep 12, 2014 10:43 pm

Zimlet to get and parse XML file from HTTP server?

Postby batfastad » Thu Oct 13, 2011 6:53 am

Hi everyone
I'm desinging a Zimlet to integrate with our intranet.

I've got a blank Zimlet running in a new tab but wondering if anyone has any pointers for the next stage?
Basically I'm looking to get an XML file from an HTTP server on our intranet, then parse this XML into a table of data within the zimlet.
It would be ideal if I could have the XML re-downloaded and parsed every 30 seconds as well.
Is something like this possible?

What functions should I be looking at in order to achieve something like this?
Cheers, B


tdesorbaix
Outstanding Member
Outstanding Member
Posts: 366
Joined: Fri Sep 12, 2014 10:31 pm

Zimlet to get and parse XML file from HTTP server?

Postby tdesorbaix » Thu Oct 13, 2011 9:36 am

Hi,
It should be possible.
I think you can use "AjxXmlDoc" to load/parse your xml file, and use "setInterval" to do it every 30 second.
JoshuaPrismon
Outstanding Member
Outstanding Member
Posts: 458
Joined: Fri Sep 12, 2014 9:59 pm

Zimlet to get and parse XML file from HTTP server?

Postby JoshuaPrismon » Sun Oct 16, 2011 3:42 pm

[quote user="tdesorbaix"]Hi,
It should be possible.
I think you can use "AjxXmlDoc" to load/parse your xml file, and use "setInterval" to do it every 30 second.[/QUOTE]
You also have a option to do a couple of different toolkits as well. Anything that you can include via JS can be used.
batfastad
Outstanding Member
Outstanding Member
Posts: 281
Joined: Fri Sep 12, 2014 10:43 pm

Zimlet to get and parse XML file from HTTP server?

Postby batfastad » Wed Nov 02, 2011 3:50 am

Thanks for all the info on this!

I'm relatively new to JS apart from building stuff in jQuery and other HTML form validation stuff.
What are the toolkits you can use? Do you mean full libraries like jQuery/prototype?
Also, should I output the data in JSON rather than XML? Would that be easier for the Zimlet to parse?
Cheers, B
tdesorbaix
Outstanding Member
Outstanding Member
Posts: 366
Joined: Fri Sep 12, 2014 10:31 pm

Zimlet to get and parse XML file from HTTP server?

Postby tdesorbaix » Wed Nov 02, 2011 4:43 am

[QUOTE]Anything that you can include via JS can be used.[/QUOTE]

So yes, you can include a library like jQuery in your zimlet.
Zimbra API can manage both XML and JSON output.

JSON is better/easier if you can make a response with this format.
batfastad
Outstanding Member
Outstanding Member
Posts: 281
Joined: Fri Sep 12, 2014 10:43 pm

Zimlet to get and parse XML file from HTTP server?

Postby batfastad » Wed Nov 02, 2011 7:49 am

Very cool!

Yes I'm designing the output so can easily output in JSON rather than XML.
For this, would I need an external library, or would I be able to do this using regular JS and the zimlet API?
I'm looking to loop through the JSON response and output a table and buttons based on the data contained within the response.

This Zimlet will be running as a separate "applet" tab within Zimbra.
When I output HTML elements using a Zimlet, will it be styled according to Zimbra's stylesheet?
Apologies for all the questions. Just trying to get it clear in my head as to what I need to get started.
Cheers, B

Return to “Zimlets”

Who is online

Users browsing this forum: No registered users and 1 guest