OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [xml-dev] RE: Namespaces Best Practice

> > From: Jonathan Borden [mailto:jborden@mediaone.net]
> > 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