[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: xml-dev@l...
  • Date: Wed, 19 Sep 2001 22:09:57 -0700

namespaces best practice
> > 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.

The namespace analogue is evident:  declare prefixes as locally as
practical.  (There's some wriggle room there, intentionally.)

I might prefer to see a default namespace decl at the document root,
but that's mostly to avoid mixing "universal" and, err, "local" (or
should I just say "namespace-less"?) names.

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


> > 2) Use of XML Namespaces is optional in XML document and application
> > design - however - it is a best practice to either use or not use XML
> > namespaces in a single document format/application. That is, if XML
> > Namespaces are to be used, it is a best practice to qualify all elements.

I tend to agree with that one.  Which is why I'd prefer to see a default
namespace decl (always!) at the root -- so that all names, except of
course for unprefixed attribute names, are qualified by a namespace URI
if any are qualified.

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