[
Lists Home |
Date Index |
Thread Index
]
On Fri, Dec 23, 2005 at 10:42:22PM -0800, thewade wrote:
> 3. What exactly is a namespace if not a DTD. Because the w3c xhtml
> namespace appears to be a page that itself links to a DTD and otherwise
> had no code value.
A namespace is a binding between a set of names and a URI.
The purpose is to let software recognise when two names are
the same and when they are different. This (for example) makes it
possible to combine fragments of different vocabularies using
(almost) cut and paste (if you add the namespace declarations)
to make meaningless gibberish without conflict between names.
The namespaces recommendation says nothing about DTDs or
schemas of any kind, and indeed nothing about what you get if
you try to defererence a namespace URI.
You could think of namespaces in XML as like namespaces in C++,
or qualified names in Perl, e.g. modulename::name, except that
it's entirely at the syntax level, so there's not really a concept
of an undefined name as there is in C++ or Perl.
You can't write a DTD that understands namespaces, but you can write
one that will validate if you use a particular prefix. You can even
parameterise the prefix, so you have to add a declaration like
<!ENTITY % prefix "xxx">
in your document (which will make many XML processors ignore the rest
of your internal subset and will make Web browsers take off their
shirts and run around screaming the lyrics from Hiawatha).
Often it's best to avoid DTDs when namespaces are involved :(
> So the first question is most important, the second two are academic.
I'll answer just the third, then, since this is xml-dev :-)
Best,
Liam
--
Liam Quin, W3C XML Activity Lead, http://www.w3.org/People/Quin/
http://www.holoweb.net/~liam/
|