Shoutbox

HTML and XML problem - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: HTML and XML problem (/showthread.php?tid=76054)

HTML and XML problem by MattyRid on 07-12-2007 at 12:18 AM

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>


RE: HTML and XML problem by Adeptus on 07-12-2007 at 03:08 AM

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.


RE: HTML and XML problem by MattyRid on 07-12-2007 at 03:18 AM

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.


RE: HTML and XML problem by Adeptus on 07-12-2007 at 05:02 AM

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.


RE: HTML and XML problem by MattyRid on 07-12-2007 at 05:26 AM

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.
RE: HTML and XML problem by MattyRid on 07-13-2007 at 11:59 AM

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
RE: HTML and XML problem by Adeptus on 07-13-2007 at 02:23 PM

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.


RE: HTML and XML problem by MattyRid on 07-13-2007 at 09:22 PM

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?