Jump to: navigation, search


namespaced attributes considered harmful

Namespaced attributes are undesirable for numerous reasons.

because they are


Random namespaced attributes are invalid.

There is no standard (W3C or other) that shows how to validate namespaced attributes.

There is no validation service (e.g. like ) that validates namespaced attributes, probably because it is undefined how to validate them.

In fact, there is no spec for how to validate multiple-namespaced documents at all. W3C never solved this problem.


Just go ahead and try to get even one browser to handle CSS style rules based on some random namespaced attribute. Now try to get two browsers to do so.

There simply isn't browser support (nor even W3C Recommendations for that matter) for how to use namespaced attributes to style content.


Data in namespaced attributes (most attributes for that matter) is invisible to the user and thus undesirable. Perhaps this is worthy of pointing to another write-up: invisible-data-considered-harmful.

If you are using namespaced attributes for data "not for user consumption", i.e. not for human data but rather for purely programmatic data, just use JSON, don't even bother with markup, XML or otherwise.


namespaced attributes are ugly to read and write. more typing and punctuation. enough said.


just needs to be XHTML

Some have asserted that if you simply put namespaced attributes in proper "XHTML", e.g. sent as text/xml-xhtml [sic] then they will work fine.


namespaced-attributes-considered-harmful was last modified: Tuesday, July 10th, 2007