Events-Client Side XML Example
The following code is for example only. It is up to the web developer to determine how he/she wants to handle the XML data. This software is provided "as is", without warranty of any kind, express or implied. In no event shall Evanced Solutions be held liable for any direct, indirect, incidental, special or consequential damages arising out of the use of or inability to use this software. Evanced Solutions is not obligated to support the code due to the various ways XML is handled between browsers.
Events - Client Side XML example
To run this example you will need to copy the 3 included files into a web accessible folder on your web server.
eventsxml.html --> Example Web page used to display a window of events. eventsxml.xsl --> Style Sheet formatting file for XML data. getxml.asp --> Server-side page for obtaining the XML data and sending it to the HTML page.
Editing the XSL file is beyond the scope of this example, but many resources can be found on the internet by doing a search on the tags "XSL XML tutorial".
Editing the ASP file is beyond the scope of this example. If your server is not running ASP you may need to translate this page into server-side script that performs a similar function.
This is a reference to a file included with all Event Calendar installations. If your installation is hosted your path will look something like this:
This file should reside on the same server as the "eventsxml.html" page. A hard-coded path is not necessary if this file resides in the same folder as the HTML file.
This is your XSL formatting file. A default version of this file is included with this example. Your path to this file will probably be something like:
Unless it is located in the same folder as the HTML file and will not need a path.
This is a link to the XML feed from your calendar system. The example is a link to our training site. If your installation is hosted your path will look something like this:
URL switches can be added to this link to specify the data you want returned from this link. In this example are:
dm=xml - Format of the returned data lib=all - Use data from all branches alltime=1 - Use data from all day nd=14 - Use 14 days worth of data
The ASP file is used to perform a server side request for the XML data. if your server does not support ASP you will need to translate the ASP code into a server-side script that is support by your server. The basic concept is: the client HTML page cannot obtain the XML data directly from a different domain (causes an Access Denied error). This server-side ASP file can obtain the data and pass it to the HTML file as a string.
You will need to remove the comments from the beginning of the getxml.asp file. Since the result of this file should be XML, having a comment at the beginning will cause it to not look like XML data. Remove everything down to, but not including the "<%@ LANGUAGE="VBScript"%>"
Once the HTML and ASP file are edited with your path information, you will be able to open the HTML file in a web browser and see how the XML feed can be displayed in a simple table.
Double-clicking the file may open the file but it will also generate an ActiveX error in your browser. To properly test you should enter the URL to the HTML file in a browser window. This will eliminate the error and display the page properly.
To incorporate this into your site you will need to:
Download the example files here: https://s3.amazonaws.com/static.evanced.info/Examples/Events_Client_side_XML.zip
|Posted - Tue, Sep 27, 2011 at 2:40 PM. This article has been viewed 14553 times.|
|Online URL: https://kb.demcosoftware.com/article.php?id=78|
Powered by PHPKB (Knowledge Base Software)