Simon Willison’s Weblog

Subscribe

My first XHTML mind bomb

16th June 2002

I’ve been looking at PHP’s XML handling functions (in particular the xml_parse() function) and I’ve suddenly realised the advantages of writing entries in valid XHTML. Before I started this blog one of the features I considered adding was something that can pull all of the links out of an entry when it is submitted and index them or add them to a directory somewhere. I was preparing myself for some regular expression hacking, but thanks to XHTML this is now completely unnecessary. All I need to do is define a couple of handlers to deal with <a> tags and Expat will do the hard work for me. In fact, this approach gives me a great deal of flexibility in what I do with my entries. I can extract quotes and blockquotes, pick up on emphasized text and generally allow my blog software to “understand” my entries as and when I add them. The true benefits of XHTML have suddenly become clear.

This is My first XHTML mind bomb by Simon Willison, posted on 16th June 2002.

Next: Jonathan on Mark

Previous: Fixed validation again

Previously hosted at http://simon.incutio.com/archive/2002/06/16/myFirstXhtmlMindBomb