Sorry I didn't notice your earlier response on this, Anne. The schema specification is explicit that each complex type defines its own symbol spaces for the element and attribute definitions within that type, as I quoted. The "locally scoped" reference just means that it's not a top-level child of the schema element - top-level children of the schema are global definitions (and globally-scoped, meaning they're visible throughout the schema and also when the schema is included or imported), everything else is a local definition.

The added part that I referenced Priscilla on was just that the same element or attribute name could be reused within a single complex type definition, providing all uses specify the same type. That's something I haven't found as part of the schema specification, but was passing on to Amila as something to keep in mind when implementing the code.

 - Dennis

Dennis M. Sosnoski
SOA and Web Services in Java
Training and Consulting
http://www.sosnoski.com - http://www.sosnoski.co.nz
Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117



Anne Thomas Manes wrote:
I asked for clarification on the xml-dev list. Michael Kay concurs with Dennis. Duplicate child elements are allowed, even when elementFormDefault="qualified".

Anne

On 3/8/07, Anne Thomas Manes <[EMAIL PROTECTED]> wrote:
Maybe we should ask for clarification from Priscilla on this, but my
intepretation of

         "Locally scoped attribute and element declarations"

is that the rule refers only to unqualified attributes and elements.
If you specify elementFormDefault="qualified", then all elements in
the schema are globally scoped unless you specify form="unqualified"
on a specific element.

Anne

On 3/8/07, Dennis Sosnoski <[EMAIL PROTECTED]> wrote:
> Hi Amila,
>
> No, there is no such constraint. Schema actually states explicitly
> (http://www.w3.org/TR/xmlschema-1/#concepts-nameSymbolSpaces) that:
>
> "Locally scoped attribute and element declarations are special with
> regard to symbol spaces. Every complex type definition defines its own
> local attribute and element declaration symbol spaces, where these
> symbol spaces are distinct from each other and from any of the other
> symbol spaces. So, for example, two complex type definitions having the > same target namespace can contain a local attribute declaration for the > unqualified name "priority", or contain a local element declaration for > the name "address", without conflict or necessary relation between the two."
>
> Like most parts of the schema specification, this doesn't appear to be
> written for clarity. Why the gratuitous reference to "unqualified name" > when referring to the attribute, for instance, when it doesn't make any
> difference whether the name is qualified or unqualified? But the
> statement that "each complex type definition defines its own local
> attribute and element declaration symbol spaces" is as clear and
> definite as anything in schema.
>
> To make things even more complicated, according to Priscilla Walmsley
> ("Definitive XML Schema", 13.4.4 Duplication of element-type names) you
> can reuse the same element name within a particular complex type
> definition providing the elements have the same type. This apparently
> means that it's fine to do a definition of the type:
>
> <complexType>
>   <sequence>
>     <element name="name" type="string"/>
>     <element name="id" type="long"/>
>     <element name="name" type="string"/>
>   </sequence>
> </complexType>
>
> I don't know the particular entrails which were read to come to this
> conclusion (which I haven't found documented in the schema
> recommendation), but since she's part of the Schema Working Group her
> statements on schema are generally considered authoritative. Something
> to keep in mind when you're writing your code to handle complex types.
>
>   - Dennis
>
> Dennis M. Sosnoski
> SOA and Web Services in Java
> Training and Consulting
> http://www.sosnoski.com - http://www.sosnoski.co.nz
> Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117
>
>
>
> Amila Suriarachchi wrote:
> >
> >
> > On 3/8/07, *Dennis Sosnoski* <[EMAIL PROTECTED]
> > <mailto:[EMAIL PROTECTED]>> wrote:
> >
> > Your statement about the names is incorrect, Anne. Schema doesn't
> >     allow
> > the same name to be used for different global definitions, but you're
> >     fine reusing names for local elements in different complexTypes.
> >
> > I am also not clear about this and would like to put this question?
> > Is there any constranit that says *every element in schema should have
> > a unique Qutalified name?*
> > since the qualified name of an element only depends on the namespace
> > and the local part of the element then we have to conclude that it is
> > not possible.
> >
> > --
> > Amila Suriarachchi,
> > WSO2 Inc.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to