[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Namespace: what's the correct usage?
- From: Martin Gudgin <firstname.lastname@example.org>
- To: David Carlisle <email@example.com>
- Date: Sun, 20 May 2001 12:29:36 +0100
----- Original Message -----
From: "David Carlisle" <firstname.lastname@example.org>
Sent: Sunday, May 20, 2001 9:30 AM
Subject: Re: Namespace: what's the correct usage?
> Your last paragraph conjures up all sorts of great images! I don't
> anticipate the stuff I generate being used in other documents as most of
> is transient messages. Either way the xmlns='' of the parent will help
> protect the child elements from subversive forces ;-)
> No the xmlns="" just makes explicit that these elements are not
> "protected" by a namespace. You are losing all the value of the
> namespace rec in giving a possibility of generating unique element
I meant it would protect the elements from being 'subsumed' into another
namespace by a default namespace declaration.
> for example an XPath of //x:parent will only match your parent
> element if x: is bound to your namespace, but your child elements
> are just in with the general mess so are matched with //child
> an XPath that might have been intended for some completely different
> document type. The whole point of the namespace REC is to avoid such
> acidental clashes and have each element name unambiguously tied to its
I agree that the XPath/XSLT space ( or any other non-sequential processing
model ) has some bearing on this question. I'm still thinking about it.
> There is a local scoping happening but it is the bindings of prefixes
> (or non-prefix) to namespaces that is scoped. Your use of the unprefixed
> element names to mean the namespace of the most recently declared prefix
> is completely at odds with the interpretation specified in the namespace
I'm not interpreting it to mean 'the namespace of the most recently declared
prefix'. Unqualified means unqualified *not* unprefixed.
> why add xmlns="" to the parent and not xmlns="the namespace of the parent"
> If you did the latter, your instance documents would look more or less
> the same, with no prefixes on the children, and your elements would all
> be in the same namespace, which is a lot more natural.
More natural for who? Doesn't seem more natural for a Java programmer. But
maybe thats the issue, perhaps we should start from XML Schema and generate
the programming language mappings from there...
FWIW - I'm not trying to avoid having a prefix here. I'm trying to avoid
misleading myself into thinking that an element has global meaning when it
doesn't. I'm afraid I'm not really thinking about this at the syntax level
at all ( we just have to use it for examples ;-) ) but rather at the Infoset
level. The qualified element has a value for its namespace name whereas the
unqualified children have no value for their namespace name. When I see an
element with no value for its namespace name I know its meaning is defined
by its context.