Musing over Namespaces

David Megginson david at
Fri Dec 17 15:05:07 GMT 1999

rev-bob at writes:

> > Why is XML different?  Is it just that we come from the SGML
> > background, where we consider structural validation to be part of
> > a document rather than a process applied to it, or is there some
> > kind of a fundamental difference between naming code and naming
> > document nodes that no one has articulated yet?
> Just to take a stab in the dark here, but wouldn't this fundamental
> difference be that Perl and Java are almost unilaterally
> self-contained parcels (hence, it doesn't matter what the package is
> named, because you're writing everything that deals with it anyway),
> but XML documents are designed for interchange - where the names
> don't just have to make sense to you, but also to an unknown client?

I'd considered that possibility, but it's not true.  Consider the
following, very typical case in the Java world:

1. I write a compiled Java app that references org.xml.sax.Parser.
2. I send you the app.
3. You run the app, and the JVM complains that org.xml.sax.Parser is
   not found.

I find it very hard to see any difference between that case and the
following one:

1. I compile a data record in XML format that includes an element
   named {}alpha.
2. I send you the data record.
3. You process the record, and your processing code complains that
   {}alpha is not recognized.

In neither case is there any automatic resolution mechanism to help
you -- the JVM won't go out on the Web and find org.xml.sax.Parser for 
you if it's not already on your classpath.  I'm not disputing that
something like this could be helpful (both for Java and Namespaces),
but I am disputing that Namespaces (or Java packages) are
fundamentally incomplete without it.

> In other words, my only concern when naming a function or a class in
> a program is that I need to know what it is; I can name a variable
> "Fred" or a 50-char string class "Bubba" if I want to, and it
> doesn't matter - because nobody else needs to understand what those
> names mean.  

But they do need to know -- see my example above.  The difference is
that once you have the class files for org.xml.sax.Parser, you're
fine, while it's far from obvious what you *could* retrieve that would 
help with {}alpha.

> However, if I'm writing a document that I'm going to send somewhere
> else for Joe to deal with, I'd better use names that Joe can
> understand and easily map.  

That Joe can understand, or that his software can understand?  There's 
a significant difference there.  We could set up some mechanism so
that Joe's software could automatically retrieve a schema or schema
fragment that covers {}alpha, but that's not
much help -- Joe's software could tell that it's valid or invalid
(whoopee!), but it still couldn't tell what it means.

All the best,


David Megginson                 david at

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at
Archived as: and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo at the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo at the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at

More information about the Xml-dev mailing list