mark nottingham

XML Base: Evil?

Saturday, 21 May 2005

XML

If you accept that QNames in content are evil, the next logical question is whether XML Base is any better. In fact, if you turn your head a certain way, it appears that there’s very little difference between a default namespace and XML Base.

Why? XML Base requires someone to know when element or attribute content is a URI, because it has to be applied to them before they can be used. This leaves you in an uncomfortable spot; either the XML processor has to have type information, or the application can’t be given isolated parts of the document without the in-scope base URI.

I think, however, that XML base is significantly better, because intermediate processors don’t have license to change the syntactic form, as they do with prefixes in QNames. Also, it’s much simpler to pass a single, unchanging Base URI around when you subset a document, rather than a set of prefix/URI mappings. So, no — XML Base is not evil. Maybe a little cheeky, but not the fruit of the devil.


5 Comments

Anne said:

Every document has a base URI, regardless of xml:base.

Saturday, May 21 2005 at 12:05 PM

Paul Downey said:

i think they are analogous in that they introduce a scoping, blend layers of processing and require extra knowledge of types (as you mention). However, isn’t a big difference that you can easily finalise URIs in content by making them absolute, something that’s not possible with qnames?

Sunday, May 22 2005 at 3:38 AM

Anne said:

What I meant was that you have the problems no matter what. The only difficulty xml:base adds is that an elements and its descendents may be inside another base URI than the document base URI.

The difficulty knowing which elements are links already exists.

Sunday, May 22 2005 at 12:39 PM