[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: Jonathan Borden <email@example.com>,Kohsuke KAWAGUCHI <firstname.lastname@example.org>, email@example.com
- Date: Sat, 19 May 2001 22:31:23 +0100
----- Original Message -----
From: "Jonathan Borden" <firstname.lastname@example.org>
To: "Martin Gudgin" <email@example.com>; "Kohsuke KAWAGUCHI"
Sent: Saturday, May 19, 2001 10:22 PM
Subject: RE: Namespace: what's the correct usage?
> Martin Gudgin wrote:
> > I left out the top-level element decl for conciseness. How's this;
> > <xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'
> > xmlns:this='urn:example.org.people'
> > targetNamespace='urn:example.org.people' >
> > <xs:complexType name='person' >
> > <xs:sequence>
> > <xs:element name='given' type='xs:string' />
> > <xs:element name='family' type='xs:string' />
> > </xs:sequence>
> > </xs:complexType>
> > <xs:element name='person' type='this:person' />
> > </xs:schema>
> > It's *both* an element and a complex type.
> it gets very difficult to follow what is being said when the same name is
> being used for two separate things, one an element and another a
Sorry, in future examples I'll make sure I use different names.
> it seems to me that:
> 1) the "given" and "family" elements _are not_ locally scoped to the
> "person" element.
> this is completely akin to:
> <!ENTITY % person.model "(given,family)">
> <!ELEMENT given (#PCDATA)>
> <!ELEMENT family (#PCDATA)>
> <!ELEMENT person %person.model;>
> in this case I can also do:
> <!ELEMENT another.person %person.model;>
> <xs:element name="another.person" type="this:person"/>
The given and family elements are scoped to the type. Yes, that type could
be bound to several different element names just as a type can be bound to
several symbolic names in a programming language.
> 2) it also looks like all these elements are in the same namespace (as I
Errr, no. The way the schema is written the person element is in the
namespace 'urn:example.org.people' and the given and family elements are
unqualified. Instance would be;
<p:person xmlns:p='urn:example.org.people' >