Building a web site with XML

Building a web site with XML was actually the topic of my latest seminar in Milan (SMAU 2009). During this seminar many people asked me some questions that made me think about the effective reliability of such a solution. Here are some topics:

  1. Browser support

    Versions 6, 7 and 8 of Internet Explorer support XML rendering only when the latest version of MSXML is installed and configured. In other words, these versions of IE don't have a native support for XML. What's more, the rendering of CSS styles is quite inconsistent. Check out some of my tests on this subject at CSS Zibaldone.

  2. Validation and DTDs

    Some people asked me how they could validate their XML documents. Basically, you can do this either with a custom DTD or with an XML Schema. It depends a good deal on the dimensions of your web site and the number of elements and attributes you want to use. Personally I like to write my own DTDs, but sometimes I use some XML Schemas, because this solution is faster and it doesn't force you to learn another syntax or grammar (XML Schemas are basically XML).

  3. Element names

    Coming to XML element names, it's always a good choice to use semantic element names, such as branding, content-sub and the like (see Andy Clarke's thoughts on the subject), and avoid presentational names such as header or sidebar.

  4. Using XSLT

    For the final rendering of our document structure, the preferred choice is using XSLT. By doing so, you can serve your structure as XHTML and prevent some browser inconsistencies from happening. For example, if you want to use hyperlinks in your documents, using XLink is not the best solution, because the current browser support is really poor.

  5. Accessibility

    Theoretically speaking, if you use XSLT to transform your XML structure into XHTML, browsers should treat your documents accordingly, and recognize your XML elements as XHTML elements. Anyway, I didn't test it with a screen reader, so you should always run some tests before using this solution. If not, screen readers will probably not recognize your elements and some serious accessibility problems will arise.

Leave a Reply

Note: Only a member of this blog may post a comment.