RDFa Tutorials

RDFa Tutorials

Design Notes

Do NOT use the popular shortcuts known from XML for empty elements in RDFa markup.

I.e., instead of


ALWAYS use the long form


This hold for all elements that contain RDFa attributes.
Earlier versions of HTML and many HTML documents in the wild were not well-formed, i.e., they often did not close elements properly.
This caused the browser industry to employ tricks for dealing with inconsistent markup.

Now, if you are using RDFa in an XHTML document, the shortcut can cause problems depending on the media-type indicated by your server.
- If the media-type is XML, many modern browsers have no problem.
- However, if the XHTML page is served as HTML, many browsers apply heuristics that unfortunately turn the RDFa markup inconsistent.
- Serving the document with XML as a media type instead can in turn create problems with old browsers, so that is not recommended either.
For many Web developers, the media type served is out of their control anyway. Many hosting packages always serve .html and .htm as HTML.

Thus, avoid the shortcut for empty elements in RDFa markup. See the following document for background info: http://tr.im/z8f1

Based on email from Martin Hepp