Writing Friendly Code - Part 2, XFiles
The Clockwise Box (X Files)
For a moment, let's look ahead. In the near future, XML is going to be the basis for transferring data. Already the W3C has issued a proposal that specifies how we can make our HTML valid XML (XHTML). Technically it is no big deal- XML is SGML; HTML is SGML. Both of these markup languages are simply SGML subsets that use specific DTDs (document type definitions). These are the lists of elements and attributes with the rules that browsers and other clients use to present them. Browsers use their own copies of the lists (more or less) and don't need to download the DTD file every time they read a Web page. The browser's internal DTDs are where they play fast and loose on tag interpretation. This is why our pages look different in different browsers.
The HTML 4 DTD is big; it has grown considerably since Berners-Lee first wrote one in the pre-Mosaic days, but it is still, to some folk's minds, too restrictive. The addition of CSS and CSS2 have allowed us to get most of the formatting out of the markup, but we still have a finite number of tags and they still have narrowly defined roles and rules.
Aha - SML is a roll your own language. You define your own DTD for your application and put it in or call it from your documents. The elements you use can be a mix of what you like from HTML and what you wish you had. Lovely. It means future clients won't have to creatively figure out your presentation, they can follow the rules laid out in the DTD. It is especially suited for B2B and machine to machine data transfers, and is how Microsoft, for instance, has set up its Office 2000 applications to communicate among themselves.
Not all of us are going to write XML or XML DTDs. A lot of us are going to continue to use the HTML syntax. Which may as well be valid XML. The difference between HTML and XHTML is in who will be able to access your pages, and what they can do with them. It is a good idea to write your HTML as valid XHTML. It certainly won't break any older browser, and it just might be all you have to do to give the next generation of Internet clients access to your work.
Comments are welcome