XML calendar markup suggestions?

phatcactus

The Ugly Organist
I'm making my band a shiny new website, and I've decided to store its innards as XML instead of the weird custom markup I was using before. Parts of the site's data are based on dates, and I've come up with two possible ways to format it.

Way one...
Code:
<event_list>
	<year n="2003">
		<month n="10">
			<day n="31">
				<event>
					<data>Yadda yadda!</data>
					<time>20:00</time>
				</event>
			</day>
		</month>
	</year>
</event_list>

...and way two...
Code:
<event_list>
	<event>
		<date>
			<year>2003</year>
			<month>10</month>
			<day>31</day>
			<hour>20</hour>
			<minute>00</minute>
		</date>
		<data>Yadda yadda!</data>
	</event>
</event_list>

The first one seems more semantically proper, as the year/month/day contains the event, instead of the event/date/(year,month,day). But the second one is a bit easier to work with.

I'm just wondering if there is some precedence dictating how something like this should be done. There's no difference to the viewer of the site, and nobody will ever see this stuff but me, but as long as I'm learning to do this, I'd like to learn the right (or at least best) way.

And I'm intensely anal. ::evil::
 
Yes! Semantics! The question you have to ask yourself is are you just going to be using the hierarchy for different events, or do you want to have it be versatile outside the realm of dates. Because with method 2 the event seems to be more important then the date, and it will be easier to incorporate other types of data into the event.
But with the first way... Oh geez I had a really good thing to say... ugh I lost it.
I think that for a calendar number one is definitely the way to go. You will have more options to style the data as a calendar, with css. It also makes it fairly obvious that the data represents a calendar -- not just an events list.
btw - what do you use to transform the xml backend into the xhtml? A server side app?
 
Now I think #1, or some variation, is the best way, just because literally, years are not on the same level as months are not on the same level as days. It's a little bewildering to parse sometimes, but I think the peace of mind is worth it.

For transforming, I've been using the XSLT functions included in Marc Liyanage's PHP Apache module (http://www.entropy.ch/software/macosx/php/).

If you get into XSL, I also recommend his app TestXSLT (http://www.entropy.ch/software/macosx/#testxslt). It's great for debugging, as the four parsers it includes each give slightly different results when bugs pop up.
 
Back
Top