What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » HTML and XML problem

HTML and XML problem
Author: Message:
MattyRid
Veteran Member
*****

Avatar
Red Bull Racing Australia

Posts: 1321
Reputation: 21
– / Male / Flag
Joined: Jan 2006
Status: Away
O.P. HTML and XML problem
OK let me give a little background...I am building a new website fro someone who wishes to have a calender on there and I have decided to use an XML file to store each date and it's even and then I have a HTML file which automatically add rows to accommodate the number of events.

The only thing is whenever I update the XML file, the date is never correct in the HTML file....so the question I ask is, what in the world is wrong? is it because I have a date preset in my code? Is there a way for the HTML file to check the XML file's modified date automatically?

code:
<body class="main">
<xml id="Calendar_Info" src="calendar.xml"></xml>
<table width="635">
  <tbody>
    <tr>
      <td class="mainhead" align="center">
      <div class="boldmaroonhead">Calendar</div>
      <div class="blacktext">Last Updated On: 11 August 2004<!---- this section imports the data from the XML file into a table ---->
      <div class="menuspace">
      <table width="600" class="calendar_table" border="1"
bordercolordark="#B22222" bordercolorlight="#B22222" cellspacing="0"
cellpadding="2" datasrc="#Calendar_Info" id="CalendarTable">
        <thead> <tr class="calendar_table">
          <td width="175" class="calendarhead">
          <div class="maroontext">Date</div>
          </td>
          <td width="425" class="calendarhead">
          <div class="maroontext">Event Description</div>
          </td>
        </tr>
        </thead> <tbody>
          <tr>
            <td align="left" valign="top" class="whitebg"><span
class="blacktext" datafld="date"></span><br>
            </td>
            <td align="left" valign="top" class="whitebg"><span
class="blacktext" datafld="$text"></span><br>
            </td>
          </tr>
        </tbody>
      </table>
      <div class="menuspace"><!---- end section ---- !--> The
information presented on this is imported from an XML file which
consists of several 'event' elements which describes the particular
event as well as an attribute called 'date' which shows the date which
the event will occur. </div>
      </div>
      </div>
      </td>
    </tr>
  </tbody>
</table>
</body>

Red Bull Racing Australia - Triple Eight Race Engineering - Holden
07-12-2007 12:18 AM
Profile PM Find Quote Report
Adeptus
Senior Member
****


Posts: 732
Reputation: 40
Joined: Oct 2005
RE: HTML and XML problem
You are having problems with the browser caching the XML file (you can test this by clearing your browser cache after you have made a change to the XML).

Since you can't use meta tags in an XML data file, you need a different solution to control caching.  You can use the .htaccess based methods described here, provided your Apache server has the required modules loaded.

If you can't do that, make a PHP page that sets the 'text/xml" content type along with the desired cache control headers and simply dumps your XML as output.  Reference that instead of the XML file directly.

The third trick people use for this is to load the XML island using Javascript and append a random number query string, so that the request looks like "myfile.xml?7543758", the number being different every time.  This is probably the least clean, most kludge way --  it doesn't stop caching, just tricks the browser into not using the cached copies, thus polluting the browser cache.
07-12-2007 03:08 AM
Profile E-Mail PM Find Quote Report
MattyRid
Veteran Member
*****

Avatar
Red Bull Racing Australia

Posts: 1321
Reputation: 21
– / Male / Flag
Joined: Jan 2006
Status: Away
O.P. RE: HTML and XML problem
well .htaccess is out of the question.

They plan to use this as an intranet site without having to use apache or php (:@).

I'll have a go at using an XML island and see how it goes.
Red Bull Racing Australia - Triple Eight Race Engineering - Holden
07-12-2007 03:18 AM
Profile PM Find Quote Report
Adeptus
Senior Member
****


Posts: 732
Reputation: 40
Joined: Oct 2005
RE: HTML and XML problem
What do they use?  IIS?  I only made the suggestion for Apache because that is what most common hosting uses.   There are ways to do this with any web server.
07-12-2007 05:02 AM
Profile E-Mail PM Find Quote Report
MattyRid
Veteran Member
*****

Avatar
Red Bull Racing Australia

Posts: 1321
Reputation: 21
– / Male / Flag
Joined: Jan 2006
Status: Away
O.P. RE: HTML and XML problem
quote:
Originally posted by Adeptus
What do they use?  IIS?  I only made the suggestion for Apache because that is what most common hosting uses.   There are ways to do this with any web server.

All I know at this stage is that php and apache is a no no for them, my assumption would be that they use IIS but then again, I've seen stranger things.

EDIT: I have found out that they in fact do use IIS as they have an intranet forum which requires them to use IIS and in fact requires a link to it from the website I'm creating, guess I'm lucky then in some ways.

This post was edited on 07-12-2007 at 11:36 PM by MattyRid.
Red Bull Racing Australia - Triple Eight Race Engineering - Holden
07-12-2007 05:26 AM
Profile PM Find Quote Report
MattyRid
Veteran Member
*****

Avatar
Red Bull Racing Australia

Posts: 1321
Reputation: 21
– / Male / Flag
Joined: Jan 2006
Status: Away
O.P. RE: HTML and XML problem
just to maybe help out a bit...this is the setup of the XML file

code:
<?xml version="1.0" ?>
<calendar>
    <event date="10 August 2007">Matthew Ridolfo's Birthday</event>
</calendar>


Also note my edit above about IIS
Red Bull Racing Australia - Triple Eight Race Engineering - Holden
07-13-2007 11:59 AM
Profile PM Find Quote Report
Adeptus
Senior Member
****


Posts: 732
Reputation: 40
Joined: Oct 2005
RE: HTML and XML problem
Good thing you bumped it.  I never saw the edit about IIS.

The best thing to do with IIS is put your project in its own virtual directory with immediate expiration.  You set expiration on the "HTTP Headers" tab under virtual directory properties in IIS Manager.   You don't need to change or add anything to your code; just make sure they do the above when they deploy it.

As a reminder, you can install IIS on Windows XP Professional and Vista editions from Home Premium up -- so you should be able to test it out.
07-13-2007 02:23 PM
Profile E-Mail PM Find Quote Report
MattyRid
Veteran Member
*****

Avatar
Red Bull Racing Australia

Posts: 1321
Reputation: 21
– / Male / Flag
Joined: Jan 2006
Status: Away
O.P. RE: HTML and XML problem
Brilliant. I'll give it a go in the next hour or so.

Thanks for all the help :D

EDIT: Still now working :(

I've got a feeling that
code:
Last Updated On: 11 August 2004
shouldn't be there because wouldn't that mean that the date is hard coded rather than updating itself once the xml file is editied/updated?

This post was edited on 07-13-2007 at 11:12 PM by MattyRid.
Red Bull Racing Australia - Triple Eight Race Engineering - Holden
07-13-2007 09:22 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On