Lists Home |
Date Index |
Jeff Lowery <Jeff.Lowery@creo.com> writes:
> Wait a sec while I change into my Nomex suit...
> I'd like to propose a mechanism for minimizing namespace hassles while
> maintaining readability.
> All-in-all, given the design motivations of the WG, the basic mechanism is
> sound on a syntax level.
I'm not sure I completely agree with you. On a purely syntactic level,
namespaces can be forward references, meaning that you have to make
two passes over every start tag.
On a architectural level, I think the design of namespace declarations
favors a very rare use case: when prefix mappings are defined on a
large proportion of start tags and are redefined in the same
scope. Most documents I've seen (a finite number, admittedly) define
all of their prefixes on the document element. Some introduce
additional mappings lower down. Few redefine previously declared
> My opinion is that the answer lies in a prefix registry.
In my opinion, the answer lies in rethinking the purpose of namespaces
and their use cases, not in fixing the symptoms. One purpose of
namespaces was to invent a shorthand notation for (long) unique
names. If you make the /prefix/ unique, in essence making the whole
tag unique, you're right back where you started. If the part before
the colon has no specific meaning, how is <xsl:value-of select="."/>
better than <xsl-value-of select="."/>?
If you are ready to take on "Namespaces in XML", I would suggest
something along the lines Michael Kay was talking about, a mechanism
similar to Java packages. I would use PIs to define mappings, or
perhaps even a special element, something like
<xml:ns xsl="http://www.w3.org/1999/XSL/Transform"> The scope of a
mapping would be the contents of the element. Unlike in Java, I would
allow definitions anywhere in the document (I hear those who want to
modify a subtree without worrying about ancestor nodes), but would not
allow redefinitions -- check before you define! Like in Java, this
mechanism would allow you to use either a shorthand notation for
brevity or a full notation where you wanted to completely disambiguate
> The advantage of a registry is that prefixed names become universal names
> when prefixes are registered. There are no scope issues. The primary
> disadvantage of registration is that there will be a prefix rush.
And as soon as all the good ones will be taken, all you'll be able to
get will be e-yourdomain-with-some-trailing-junk-online. Now that's a
prefix I'd like to hand-type in my documents.
Say, why not just use fully-qualified DNS names or elements? You
already have a registry. Plus, these would be perfectly valid XML 1.0