On Fri, Oct 08, 2004 at 08:28:12PM -0400, John Weiss wrote:
> On Fri, Oct 08, 2004 at 10:21:02PM +0200, Lars Gullik Bjønnes wrote:
> > 
> > How do you decalre a namespace in a DTD?

Okay, just read up on XML namespaces.

- A namespace is uniquely identified by a URL.  Doesn't have to be an
  HTTP-resolvable URL; it's just a label.

- Unlike C++ namespaces, in XML, the "name" of the namespace is just
  an in-doc label.

- The namespace is "defined" as a special attribute on any element,
  and is "visible" only to the subtree rooted at that element.
  Ususally, you define all of your namespaces on the root node.

- You define a namespace with this special attribute:

      "xmlns:" + ns_defn_name "=\"" + namespaceURL_ID + "\""

   ... where `ns_defn_name' is the label you're going to use for the
   namespace and `namespaceURL_ID' is the URL that uniquely identifies
   the namespace

   What all of that gobbledygook means is that you could define the
   "special_chars" namespace as:

   <body xmlns:special_chars="http://www.lyx.org/special_chars_ns/";>

   or as:

   <body xmlns:sc="http://www.lyx.org/special_chars_ns/";>

   or even as:

   <body xmlns:sc="http://www.lyx.org/special_chars_ns/";>

- The actual element and attribute names are defined in a regular old
  DTD.

  At this point, I get a bit unsure.  I *think* you don't need to
  qualify the namespace members with the `namespace_name + ":"'.  I
  could be wrong.

  I'm also not too clear on how you include this DTD into the
  document.  All I know is that the URL used to uniquely identify the
  namespace ... has nothing whatsoever to do with it.  Yeah, I know.
  Weird, huh?


I do know that XSchema has far better namespace support.  However, now
I'm beginning to doubt the utility of namespaces over nested element
tags.  *sigh*

-- 
John Weiss

Reply via email to