Zimlet to get and parse XML file from HTTP server?

Interested in talking about Mash-up's? This is the place.
Post Reply
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?

Post by batfastad »

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?

Post by 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.
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?

Post by JoshuaPrismon »

[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?

Post by batfastad »

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?

Post by tdesorbaix »

[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?

Post by batfastad »

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
Post Reply