- From: <noah_mendelsohn@us.ibm.com>
- Date: Sat, 9 Apr 2005 08:34:44 -0400
- To: "Nicolas Mailhot" <nicolas.mailhot@laposte.net>
- Cc: xmlschema-dev@w3.org
- Message-ID: <OF9019FD36.D2F577E1-ON85256FDE.0044C614-85256FDE.00451AA9@lotus.com>
Nicolas Mailhot asks: > I've been sent an xsd that uses > the following construct : > <xsi:element name="foo"> > <xsi:complexType name="foo"> > Is this something allowed ? As several writers have correctly responded, complexTypes within an element declaration must be anonymous. What they did not point out, however, is that there is otherwise no problem having a type and an element declaration with the same name. They are in what the recommendation calls separate "symbol spaces". [1] Quoting from that: "2.5 Names and Symbol Spaces As discussed in XML Schema Abstract Data Model (§2.2), most schema components (may) have ·names·. If all such names were assigned from the same "pool", then it would be impossible to have, for example, a simple type definition and an element declaration both with the name "title" in a given ·target namespace·. Therefore [Definition:] this specification introduces the term symbol space to denote a collection of names, each of which is unique with respect to the others. A symbol space is similar to the non-normative concept of namespace partition introduced in [XML-Namespaces]. There is a single distinct symbol space within a given ·target namespace· for each kind of definition and declaration component identified in XML Schema Abstract Data Model (§2.2), except that within a target namespace, simple type definitions and complex type definitions share a symbol space. Within a given symbol space, names are unique, but the same name may appear in more than one symbol space without conflict. For example, the same name can appear in both a type definition and an element declaration, without conflict or necessary relation between the two. 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." Hope this helps. Noah [1] http://www.w3.org/TR/2004/PER-xmlschema-1-20040318/#concepts-nameSymbolSpaces -------------------------------------- Noah Mendelsohn IBM Corporation One Rogers Street Cambridge, MA 02142 1-617-693-4036 --------------------------------------
Received on Saturday, 9 April 2005 12:34:54 UTC