27 November 2005

Elements and Attributes and CSS

VoIP technically sucks: trying to fake a switched circuit connection with packet switching is inherently inefficient.

However, if 99% of the data on the network is well suited to packet switching, putting the rest of the data on the same platform is much more sensible than having a whole separate network just for 1%. I don't know if voice traffic is as low as 1% of total traffic over the world's data network, but if it isn't yet it soon will be. VoIP is therefore the only sensible way to carry voice traffic.

That was just a demonstration.

99% of the web page data you are reading is marked-up text: words you want to read, along with markup describing how different bits of the text should be presented. HTML is a decent format for that, and XHTML is much better - more logical, easier to parse, more extensible.

The other 1% (the element) is document-level metadata - not stuff you're meant to read. XHTML is a poor format for that, but it's only 1%, and it's better to use an inappropriate format than add a separate format into the same document for 1% of the content. So we put up with <meta name="generator" content="blogger"/> despite it's clunkiness.

XML is designed for marked-up-text formats like XHTML. At a pinch, it can be used for other things (like document-level metadata), but it's fairly crap. So when Tim Bray says:

Today I observe empirically that people who write markup languages like having elements and attributes, and I feel nervous about telling people what they should and shouldn't like. Also, I have one argument by example that I think is incredibly powerful, a show-stopper:

<a href="http://www.w3.org/">the W3C</a>

This just seems like an elegantly simple and expressive way to encode an anchored one-way hyperlink, and I would resent any syntax that forced me to write it differently.

He's arguing against "use the best general-purpose format for everything", and in favour of "use a suitable special-purpose format for the job at hand, like XML for marked-up text".

A special prize to those who noticed that my XHTML <head> example was just plain wrong. 90% of the head of this document is not XML at all - a document with a completely different syntax is embedded in the XML. Blogger and the W3C have decided that XML is so inappropriate that it shouldn't be used for this data, even at the cost of needing two parsers to parse one document.

To paraphrase Tim Bray,
writing body{margin:0px;
padding:0px;background:#f6f6f6;color:#000000;font-family:"Trebuchet MS",Trebuchet,Verdana,Sans-Serif;} just seems like an elegantly simple and expressive way to encode complex structured information, and I would resent any syntax that forced me to write about 1K of XML to do the same thing.

1 comment:

Scribbler said...

I Created the entire site www.shoutluton.com in XML and it works!