[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Namespaces,
- From: Michael Brennan <Michael_Brennan@allegis.com>
- To: xml-dev@lists.xml.org
- Date: Tue, 31 Jul 2001 16:30:53 -0700
> From: Richard Tobin [mailto:richard@cogsci.ed.ac.uk]
<snip/>
> Incidentally, this use of unqualified local elements is very natural
> for some applications. Consider structures in a traditional
> programming language like C, and represent the fields of the structure
> by subelements. Do you expect to have to qualify the field names?
Yes, if you want to use them outside of their definition.
> No, they are scoped by the type of structure containing them.
In the definition, yes. That makes sense since the scope is implicit and
cannot be otherwise (completely unlike XML namespaces). In any code that
accesses the field, though, the field must be explicitly qualified with the
name of the containing instance.
This sort of analogy just lends itself to greater confusion on namespaces,
not greater understanding. Unlike a struct in C, a namespace does not
implicitly constrain the valid children of an element. A schema *may* do so
if the author wishes, but that is not required. A C struct always implicitly
does so, and there is no way around it -- except by defining a new struct
(or defining some ugly (void *) field and doing dangerous coercions at
runtime).