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

Re: RE: Namespaces Best Practice

  • From: Jonathan Borden <jborden@m...>
  • To: David Brownell <david-b@p...>, xml-dev@l...
  • Date: Thu, 20 Sep 2001 10:32:25 -0400

xml namespace lexical scope
David Brownell wrote:
> > > From: Jonathan Borden [mailto:jborden@m...]
> > > Sent: 26 August 2001 19:56
> > >
> > > 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

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

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

Jonathan


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.