W3C home > Mailing lists > Public > xmlschema-dev@w3.org > June 2001

Re: element name/ref uniqueness

From: Jeff Rafter <jeffrafter@definedweb.com>
Date: Wed, 6 Jun 2001 23:57:33 -0700
Message-ID: <010801c0ef1f$21287ca0$f181fea9@lazarus>
To: "Michael Shapiro" <michael@creativescience.com>, "Eddie Robertsson" <eddie@allette.com.au>
Cc: <xmlschema-dev@w3.org>

> Let's hope that "...someone with a better understanding of the spec can
help
> us out here..."

Uh... that isn't me. But why not give it a whack... This section is really
confusing mainly because of the separate terms wrt scope, symbol spaces,
declaration, validation and particle.

> > > > <schema>
> > > >     <element name="inner"/> <!-- Top-level declaration -->
> > > >     <element name="outer"> <!-- Top-level declaration -->
> > > >         <complexType>
> > > >             <sequence>


The reference to a top-level *declaration* indicates that this schema
component is a {Particle}.  Therefore it is in a separate symbol space from
declarations within this complexType and is treated as a {Particle}
locally-- but it's scope should be global.

> > > >                 <!-- Reference to Top-level declaration -->
> > > >                 <element ref="inner"/>

As noted by the comment-- this is fully local, and is an Element
Declaration, not Particle component.

> > > >                 <!-- Local declaration -->
> > > >                 <element name="inner"/>
> > > >             </sequence>
> > > >         </complexType>
> > > >     </element>
> > > > </schema>

Therefore-- because of the separate symbol spaces this example would seem to
be allowed without question. Of course.. the waters only get murky from
here.  The element declaration component is also treated as a particle
within a model group (e.g. sequence).  Henceforth (and in the other sample
you gave with two same named elements but no refs) the model group rules
apply:

  Schema Component Constraint: Element Declarations Consistent

  1 all their {type definition}s must have a non-·absent· name.
  2 all their {type definition}s must have the same name.
  3 all their {type definition}s must have the same target namespace.

Because both (actually either) the Global and Local definitions within the
sequence fail on point 1-- the Element consistency is violated thus making
this invalid.  If the global and local components had both specified the
type as xsd:string for example, this would be allowable.

BTW, my answer changed three times while writing this email <g/>.

Hope this clarifies,

Jeff Rafter
Defined Systems
http://www.defined.net
XML Development and Developer Web Hosting

----- Original Message -----
From: "Michael Shapiro" <michael@creativescience.com>
To: "Eddie Robertsson" <eddie@allette.com.au>
Cc: <xmlschema-dev@w3.org>
Sent: Thursday, May 17, 2001 12:26 PM
Subject: Re: element name/ref uniqueness


> Eddie, thanks for your help.
>
> IMHO, the spec understanding (and, therefore, wide acceptance) value is
> underestimated by the spec authors.
> Sure, Primer is very helpful and is considered by many as *the most
> important* part of the spec but it does not (and should not) cover all the
> details. Well, TR/xmlschema-1 does not cover all the details either,
> sometimes leaving the interpretation of itself to the mail lists :)
>
> Thanks again,
> Michael
>
> > > > <schema>
> > > >     <element name="inner"/> <!-- Top-level declaration -->
> > > >     <element name="outer"> <!-- Top-level declaration -->
> > > >         <complexType>
> > > >             <sequence>
> > > >                 <!-- Reference to Top-level declaration -->
> > > >                 <element ref="inner"/>
> > > >                 <!-- Local declaration -->
> > > >                 <element name="inner"/>
> > > >             </sequence>
> > > >         </complexType>
> > > >     </element>
> > > > </schema>
> > >
> > > For me it looks like the <element name="inner"/> has both
> > > a top-level declaration and a local declaration and that makes
> > > this schema invalid (at least that's how I read the spec:
> > > in absence of the clarification of the matter in XMLSchema.xsd
> > > such an interpretation is possible, even if it contradicts
> > > the intensions of the document authors ;-)
> > >
> > > Would you please elaborate a little bit more on the [1] to [2]
> relations.
> >
> > Hmm, after rereading the relevant sections in the spec I believe that
you
> are
> > correct. It does actually look like the <element name="inner"/> has both
a
> > top-level declaration and a local declaration. Hopefully someone with a
> better
> > understanding of the spec can help us out here...
> >
> > Cheers,
> > /Eddie
>
Received on Thursday, 7 June 2001 02:57:48 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:21 GMT