Robin Berjon

XML Bad Practices

Not Allowing Foreign Namespaces

It can be at times rather ironic to see language authors go to the trouble of properly using namespaces throughout their design, only to forbid that elements or attributes from other namespaces appear within their own (or sometimes, making it so they can only appear at designated places, much like smokers at airports).

Whenever such limitations are imposed, the value of XML is decreased as the extensibility it promises is taken away. There are two primary reasons for this unfortunate situation. One is bad validation technology: there is a good case to be made for saying that since XML Schema does not consider arbitrary namespaces valid by default (and makes it quite difficult to specify a language in which they are accepted), it should really be called ML Schema. NVDL addresses this, but it isn't used widely enough yet.

Another is bad processing rules: it is not overly difficult to specify how foreign namespaces should be handled (skip over them for processing, but include them at the XML level if it is exposed, e.g. in the DOM), but it is often overlooked. These rules are generally worth specifying as they are often the same rules that make versioning possible: ignoring what is not understood a processor can still handle future versions of its own language. We will look at some of these approaches when we take a closer look at error processing and versioning strategies.

This article is part of a series on XML Bad Practices.