[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Namespace: what's the correct usage?
- From: Kohsuke KAWAGUCHI <email@example.com>
- To: Martin Gudgin <firstname.lastname@example.org>, email@example.com
- Date: Thu, 17 May 2001 09:43:05 -0700
> They are local to the person
> class. The person class *is* in the namespace but the fields are not.
It seems to me that you are mixing up types and instances.
It would certainly make sense if you say your Person class as a type
resides in the namespace "http://best.practice.com" but the type of the familyName
is String so it should be in a different namespace.
In other words, the following type definition would make sense.
<complexType name="Person" xmlns:java="...">
<element name="firstName" type="java:String"/>
<element name="lastName" type="java:String"/>
But in the instance below, you use "person","firstName", and "lastName" as
an instance name, not as a type.
<lastName> KAWAGUCHI </lastName>
<firstName> Kohsuke </firstName>
So why you qualify "person" as an instance name while you don't qualify
"firstName" and "lastName" as instance names.
Correct me if I'm wrong. As far as I know, when the concept of this
unqualified local element is introduced (back in 1999,Nov), the rationale
is that you can find the corresponding declaration only by seeing the
tag name. So I believe XML Schema invents your way of using XML
SVG, SMIL, MathML ... There are plenty of schemas that use XML
namespaces in my way. Would you show me some specs that use XML
namespaces as you suggest?
> If, and it's a *very* big if, I came across familyName in isolation then
> you're right, I wouldn't know what to do with it. I would need to walk back
> up the tree until I found a namespace qualified element that I recognized.
> What's the big deal? This happens with attributes all the time.
Technically it's not a big deal, but it's still an extra work. Because
you don't need to look up descendants if you qualify elements from the
And sorry I couldn't get the sentence "This happens with attributes all