[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Namespace: what's the correct usage?
- From: Martin Gudgin <marting@develop.com>
- To: "Simon St.Laurent" <simonstl@simonstl.com>
- Date: Sat, 19 May 2001 23:38:56 +0100
----- Original Message -----
From: "Simon St.Laurent" <simonstl@simonstl.com>
To: "Martin Gudgin" <marting@develop.com>
Cc: <xml-dev@lists.xml.org>
Sent: Saturday, May 19, 2001 7:27 PM
Subject: Re: Namespace: what's the correct usage?
> On 19 May 2001 21:17:06 +0100, Martin Gudgin wrote:
> > > > package example.org.person;
> > > >
> > > > public class person
> > > > {
> > > > String given;
> > > > String family;
> > > > }
> > > >
> > > > to me at least...
> > >
> > > The difference is that in XML elements are first class entities, that
is
> > the
> > > "given" element is not declared within the scope of the "person"
class.
> >
> > But attributes are declared in the scope of their owner element. Why not
> > child elements? This is the crux of the question I think.
>
> You certainly can write processors which behave this way, but there's
> nothing _in the markup_ which indicates that the namespace scope for the
> child elements behaves that way.
[MJG]
What about the qualified parent element? It is in the markup and would serve
perfectly well as a namespace scope for its attributes. I'm just extending
that in my case to the child elements.
>
> If you start from public class person and think of it as a simple
> serialization problem, you may well end up with a very different answer
> than if you set out to solve the question of how best to mark this
> information up in an XML document.
[MJG]
Agreed. But local scoping is useful in programming languages and I
anticipate that it will be ( is? ) useful in XML documents even when not
dealing with class serialization.
>
> Unfortunately, I think the way you're going about using namespaces makes
> a lot of potentially unfounded assumptions about how the document will
> be processed. In an environment you completely control, that's fine,
> but if your documents ever leak out to the rest of the world, you may
> well find that no one else shares your assumptions and that therefore
> the document is interpreted quite differently.
[MJG]
I think whichever way you use namespaces you are making assumptions about
the people who will see and process your XML. People use local scoping in
programming languages because it was recognised that putting everything in
global variables was a bad idea. I suspect that over time a similar
observation may apply to XML.
Cheers
Gudge