Re: Unnamed type in <schema>

Hi Sylvain,

> Apparently, the "name" attribute of a type definition is optional,
> even if the type is defined under <schema>.

Admittedly it takes a bit of trawling to find out, but I don't think
the name attribute is optional on top-level xs:complexType elements.
Under the Schema Representation Constraint: Complex Type Definition
Representation OK in Section 3.4.3 it says:

  "In addition to the conditions imposed on <complexType> element
   information items by the schema for schemas, all of the following
   must be true:..."

Looking at the schema-for-schemas, you find that xs:complexType
elements directly under xs:schema elements are declared with:

<xs:element name="complexType" type="xs:topLevelComplexType"
            id="complexType">
  <xs:annotation>
     <xs:documentation
       source="http://www.w3.org/TR/xmlschema-1/#element-complexType"/>
  </xs:annotation>
</xs:element>

And the xs:topLevelComplexType is defined as:

<xs:complexType name="topLevelComplexType">
  <xs:complexContent>
    <xs:restriction base="xs:complexType">
      <xs:sequence>
        <xs:element ref="xs:annotation" minOccurs="0"/>
        <xs:group ref="xs:complexTypeModel"/>
      </xs:sequence>
      <xs:attribute name="name" type="xs:NCName" use="required"/>
    </xs:restriction>
  </xs:complexContent>
</xs:complexType>

As you can see, the name attribute is *required* on these
xs:complexType elements.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

Received on Wednesday, 16 January 2002 11:10:13 UTC