Sunday, August 07, 2005

Adding Proprietary Attributes Saga: The X in XHTML

I was recently working on some modifications to my feed aggregator application and have been inspired by the recent trend in high profile applications (Gmail, Google Maps etc) to move some of the processing from the server to the client side.

What I wanted to achieve was the behaviour of JavaRSS.com but with the "what’s new" processing happening through JavaScript on the client side. In this way I can deliver a static page and with JavaScript manipulation of cookies and a little DHTML I can have it appear to the client that it is doing some sophisticated personalisation.

My simple solution was to add a date attribute to the list items on my unordered newsfeed lists. I can then access this attribute using DOM in client side JavaScript and change the CSS class of the list item to new/old appearance as appropriate.

So I did this and it works, it is well-formed XML but it produces XHTML that does not validate as XHTML (it has potentially hundreds of warnings). Hold on, I thought, doesn’t the X in XHTML stand for Extensible? I can make it standards compliant by adding my additional attribute into the DTD of XHTML and therefore make it standards compliant or so I thought...

I managed to create a page that would pass for XHTML 1.0 strict (actually it said it was tentatively valid) and as valid XHTML 1.1 strict. However the page now has annoying "]>" characters at the top, grrr.

Valid but look bad:

The "]>" disappear in Firefox if you change the extension to ".xhtml" but then IE can’t read it.

I tried defining an external XHTML 1.0 DTD but I didn’t get very far as a lot of online validators seem to ignore external custom DTDs.

Invalid (who knows why!):

I read somewhere that XHTML 1.1 is actually designed to be extensible whereas XHTML 1.0 isn’t really designed that way. So I tried to create an external XHTML 1.1 DTD. Don’t get me wrong, I’m not some kind of genius but I have a fair understanding (or so I thought) of XML, XSLT, DTD and XML Schema and the like. I even check the DTD when something in my Tomcat WEB.XML isn’t working right. So you’d think I’d be able to understand the XHMTL 1.1 Modularisation concepts, sorry to tell you that this appeared to me to be completely unintelligible (perhaps you have to be in the right mood). As I said I’ve been working with XML technology for years. What hope would a novice have of creating an XHTML 1.1 extension? Please note, I only actually wanted to add a single attribute (in a different namespace) to XHTML and so you would think it would be really easy...

Conclusion

My conclusion from all this would be that however well intentioned you might be towards standards you occasionally have to "stuff the standards".
Version 1 of the above works in both the browsers that I care about it working in (IE and Firefox) and that is all that really concerns me.

Resources used:

1 comments:

Benny said...

In relation to displaying format, you will discover replica watches sale two formats that's, digital and analog. The analog display format is prevalent in classic like hublot replica watches. These watches are usually crafted in a classic manner to fit certain class of clientele. They also do not come low priced as you need to portion having a great level of money to lay hands on tag heuer replica sale. The issue of such watches that use the analog format is that some are bound to lose replica watches sale every day because of the way they may be developed which means that they're at times not the most effective rolex replica sale for precise time-keeping. Men's and ladies watches also are available in digital format. A single of the most popular digital brands you will find inside the market could be the rolex replica watches. They ordinarily include functions like calculator, stopwatch, and alarm and so on.