Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Zimlets

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-13-2011, 04:53 AM
Elite Member
 
Posts: 275
Default Zimlet to get and parse XML file from HTTP server?

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
__________________
My Zimbra Bugs Wishlist: 16411, 24567, 35676, 36430, 37770, 41872, 43733, 44384, 46383, 47759
And a way to associate mailto: handlers with a Zimbra Prism webapp
Reply With Quote
  #2 (permalink)  
Old 10-13-2011, 07:36 AM
Zimlet Guru & Moderator
 
Posts: 288
Default

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.
Reply With Quote
  #3 (permalink)  
Old 10-16-2011, 01:42 PM
Zimlet Guru & Moderator
 
Posts: 467
Default

Quote:
Originally Posted by tdesorbaix View Post
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.
You also have a option to do a couple of different toolkits as well. Anything that you can include via JS can be used.
Reply With Quote
  #4 (permalink)  
Old 11-02-2011, 01:50 AM
Elite Member
 
Posts: 275
Default

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
__________________
My Zimbra Bugs Wishlist: 16411, 24567, 35676, 36430, 37770, 41872, 43733, 44384, 46383, 47759
And a way to associate mailto: handlers with a Zimbra Prism webapp
Reply With Quote
  #5 (permalink)  
Old 11-02-2011, 02:43 AM
Zimlet Guru & Moderator
 
Posts: 288
Default

Quote:
Anything that you can include via JS can be used.
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.
Reply With Quote
  #6 (permalink)  
Old 11-02-2011, 05:49 AM
Elite Member
 
Posts: 275
Default

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
__________________
My Zimbra Bugs Wishlist: 16411, 24567, 35676, 36430, 37770, 41872, 43733, 44384, 46383, 47759
And a way to associate mailto: handlers with a Zimbra Prism webapp
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.