Re: redefinition errors

MarkH@i2.co.uk writes:

> > -----Original Message-----
> > From: ht@cogsci.ed.ac.uk [mailto:ht@cogsci.ed.ac.uk]
> > Forget that, then.  In the XML Schema context, here's the relevant
> > text [1]:
> > 
> >   "If the {particles} [of a model group] contains, either directly,
> >   indirectly (that is, within the {particles} of a contained model
> >   group, recursively) or implicitly two or more element declaration
> >   particles with the same {name} and {target namespace}, all their
> >   {type definition}s must be the same."
> > 
> > A model group is (the schema component corresponding to) a <choice>,
> > <all> or <sequence>.
> > 
> > Hope this helps
> Yes, thanks. And that appears to rule it out throughout a document since all
> elements in a document will always share a common model group at the top of
> the hierarchy?

No, there is no (or not necessarilty or normally) any common model
group at the top of the hierarchy.

> On my travels I read the bit about the scope under "definition of an
> element" [2] - which indeed says that the scope is indeed a content model.
> If you then look up content model you find that
> 
>    A particle can be used in a complex type definition to constrain the 
>    validation of the [children] of an element information item; such a 
>    particle is called a content model. [3] 
> 
> And you'll be under the impression that the scope can be restricted to allow
> multiple elements with same name, different type, so long as the scope is
> restricted to a "particle" (such as <sequence>).

restricted to a single complex type's content model == particle

> And then (with Henry's help) you find the restriction which precludes this
> [1]!!!
> 
> Life is full of disappointments that make it interesting!! :-)

Well, just to be sure we agree that you _shouldn't_ be disappointed,
the following is just fine:

<xs:schema ...>
 <xs:complexType name="bibItem">
  <xs:sequence>                                                *1*
    ...
    <xs:element name="title" type="xs:string"/>                *2*
    ...
  </xs:sequence>
 </xs:complexType>

 ...

 <xs:complexType name="person">
  <xs:sequence>                                                *1*
   . . .
   <xs:element name="title" type="xs:NMTOKEN"/>                *2*
   . . .
  </xs:sequence>
 </xs:complexType>
</xs:schema>

The two particles (= content models, given where they occur) marked
*1* are distinct contexts, so the two element declarations marked *2*
are just fine, even though they share a name and target namespace,
but their types are manifestly not the same.

ht
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2001, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/

Received on Wednesday, 10 January 2001 09:03:15 UTC