[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [xml-dev] RE: Namespaces Best Practice
- From: Jonathan Borden <firstname.lastname@example.org>
- To: David Brownell <email@example.com>, firstname.lastname@example.org
- Date: Thu, 20 Sep 2001 10:32:25 -0400
David Brownell wrote:
> > > From: Jonathan Borden [mailto:email@example.com]
> > > Sent: 26 August 2001 19:56
> > >
> > > 1) An XML Namespaces best practice for document/application design is
> > > define all namespace prefix bindings at the document (root)
> > > element context.
> For the record: yeech!
> In every style guide I've ever seen, the guidance for lexical scoping
> mechanisms is to use them to localize information to its most natural
> scope. Loop-private variables are invisible outside the loop, etc.
For the record, this best practice is lifted from "Common XML" itself a best
So I suppose this counts as at least one style guide you haven't seen.
I fail to see how a "loop private variable" relates to a namespace defined
by a URI. This is like comparing apples not with oranges but with entire
countries which themselves have farms which themselves contain orange
> (The analogy to Java package names is false; that's not a lexical
> scoping mechanism. Block scoped variables are examples of
> lexical scoping mechanisms in Java and most modern languages.
> "xmlns" declarations are lexically scoped.)
You need to understand this recommendation in its entirety. I do not
advocate reusing namespace prefixes, and so the use of namespaces in order
to accomplish "block" scoping is not really that important (IMHO). I do see
reasons why such lexical scoping may facilitate "cut and paste" operations
on namespace qualified documents, but that is a minor role of namespaces in
We need to see the role of XML Namespaces in a larger context than mere
lexical scoping. Indeed an XML Namespace is very much like a Java package.
Not identical but very much like. This is point that should be understood in
order to use XML Namespaces in broad and hopefully more useful fashion than
merely as a way to avoid name clashes within individual XML documents.