I'd love some opinions/advise on what is
considered the "Proper" (for lack of a better term like "Best Practice"
) on how to use namespaces.
I'm developing a tool which has several XML
document types which it is creating and consuming.
I started out in no-namespace but I'm evolving
towards using a namespace for them.
My rationale is
1) This will eventually be published so may be
used by a variety of people/orgs/tools so putting it in a namespace
2) SOME (but not all) of the types are embedded
in XSD and XSLT so I'd like to use a namespace to avoid ambiguity.
Since I think #2 nearly requires a namespace to
be safe, I'm thinking I should put ALL the xml this tool uses and
consumes in a namespace for consistency more than anything even if its
currently internal data only. Plus that data might eventually come
from other tools so I'm trying to be forward thinking, but at the same
time not add unnecessary complexity.
( not sure that’s *possible* with namespaces but
it’s a 'stretch goal')
So my question is …
A) Should I use a different namespace URI for
every document type ? Even if the elements it shares are completely
B) Should I use a single namespace as an
'authority' concept, saying "All elements within this namespace belong
to this toolset"
(I don’t have a better word for "authority").
My thinking so far is
A) By using a different namespace for each
document type I am associating a 1:1 schema -> namespace. This
provides the highest clarity (specificity).
Specificity and clarity are good.
B) By using a single namespace it is the minimum
needed to keep 'my stuff' separated from 'your stuff' and is the most
simple approach that still uses namespaces.
Simplicity is good.
Any ideas on how to choose which is "better" ?
I'm pretty sure there is no 'right' answer (or is there ?)
Thanks for any advice.
David A. Lee