Re: [xml-dev] Lesson Learned: Use namespaces for both markup and data

From
Liam Quin <>
To
"Costello, Roger L." <>
Date
2009-08-09T20:54:13Z
ID
<>
Thread
Re: [xml-dev] Lesson Learned: Use namespaces for both markup and data
On Sun, Aug 09, 2009 at 11:25:46AM -0400, Costello, Roger L. wrote:
>     Namespaces are not just important for markup, 
>     they are also important for data. 

I don't agree with this.

Scope and context are important for names and data.
You can use namespaces (if you are careful) to indicate
scope, in XML, and, to some extent context.

In your example,
<c:countries xmlns:c="http://www.itl.nist.gov/fipspubs/fip10-4.htm"
  xmlns:iso="http://www.iso.org/iso/english_country_names_and_code_elements">
    <c:country>iso:Afghanistan</c:country>

you have lost something important: the name of the country is not
iso:Afghanistan.  Now, every time you want to display the
country name, you need to do string processing.  Note also that
the country names are not NCNames - e.g. they can contain spaces.

If you're going to do this, next you'll be doing xdt:6 for "six".

Better might be just
<countries
  c="http://www.itl.nist.gov/fipspubs/fip10-4.htm">
  xmlns:iso="http://www.iso.org/iso/codes-pour-le-tourisme"

  <country iso:code="gb">The United Kingdom of Great Britain and
  Northern Ireland</country>

If in fact NIST and ISO do not define an XML vocabulary, you
should use a namespace URi that you own and control; you could
also consider Dublin Core in this particular case, or some other
widely-used metadata representation for places.


Just because a cup of coffee gets you going in the morning,
that's no reason to bathe exclusively in coffee :-)

Liam

-- 
Liam Quin, W3C XML Activity Lead, http://www.w3.org/People/Quin/
http://www.holoweb.net/~liam/ * http://www.fromoldbooks.org/