Nicolas Mailhot wrote:
But before I complain
about it I'd like to be dead-sure it's not allowed - if it were my own xsd
this would be different.
I have had a look through
http://www.w3.org/TR/xmlschema-1/#Co...pe_Definitions
and can't find anything in there suggesting that the name attribute on
xs:complexType is only allowed in certain cases or disallowed in other
cases.
However both Xerces Java as well as MSXML complain about that case and
indeed the schema for schemas says for topLevelComplexType
<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:anyAttribute namespace="##other" processContents="lax"/>
</xs:restriction>
</xs:complexContent>
so there the name attribute is required while for localComplexType
<xs:complexType name="localComplexType">
<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" use="prohibited"/>
<xs:attribute name="abstract" use="prohibited"/>
<xs:attribute name="final" use="prohibited"/>
<xs:attribute name="block" use="prohibited"/>
<xs:anyAttribute namespace="##other" processContents="lax"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
the name attribute is prohibited.
So you should complain if someone sends you a schema with
<xs:element name="element-name">
<xs:complexType name="type-name">
as the name attribute on the local complex type is prohibited thus the
schema is not valid.
--
Martin Honnen
http://JavaScript.FAQTs.com/