mnot’s blog

Design depends largely on constraints.” — Charles Eames

Saturday, 21 May 2005

XML Base: Evil?

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.


Filed under: XML

5 Comments

Anne said:

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

Saturday, May 21 2005 at 12:05 PM +10:00

Mark Nottingham said:

Yes…

Saturday, May 21 2005 at 2:14 PM +10:00

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 AM +10:00

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 +10:00

Mark Nottingham said:

Anne —

Ah. Maybe I didn’t choose the best title (although I’m keeping good company, looking at newspapers these days…). You’re right, of course; xml:base doesn’t really add anything to the problem I describe, it just enables it. I was looking at it from the point of view of someone who needs to choose a reference and naming scheme for a format.

Paul —

Good point.

Sunday, May 22 2005 at 9:28 AM +10:00

Creative Commons