[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: RE: Namespaces Best Practice

  • From: David Brownell <david-b@p...>
  • To: Jonathan Borden <jborden@m...>, xml-dev@l...
  • Date: Thu, 20 Sep 2001 11:13:46 -0700

java package best practice
> > > > 1) An XML Namespaces best practice for document/application design is
> > > > to 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
> practices guideline:
> http://www.simonstl.com/articles/cxmlspec.txt

That writeup adopts a per-file definition of "most natural scope",
which is more extreme than any definition I'd adopt, though
it fits into the "wriggle room" which I mentioned.

That's a bit less extreme than what you wrote, though
that still wouldn't make me adopt it! :)


> 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
> groves.

That's like ... hyperbole!

The relationship is: both bind values to names.
Both use "lexical scoping" to determine values at use point.


> > (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).

Information scoping (one variant is "information hiding") is a classic
best-practice in systems development.  Lexical scoping isn't only to
support rebinding of names to values; it's also to minimize the amount
of global state (vs maximizing it, per the CXML policy or the one
which you proposed).


>     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
> XML.

Cut'n'paste is a task, not a role, and one which is exemplary of many other
tasks.  I can understand that you may not care much about those tasks, but
that doesn't mean that they're not common parts of working with XML.


> 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.

Maybe you're talking about a policy for what the namespace URI
denotes, not about the policy for managing binding of those URIs
to prefix names (or as a default prefix).  There are other policies;
the namepaces spec doesn't touch on any preferred policy.

If that's what you're talking about, I claim apples/oranges! :)

- Dave



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.