?xml version="1.0" encoding="utf-8"?xs:schema xmlns="http://tempuri.org/ServiceDescription.xsd" xmlns:mstns="http://tempuri.org/ServiceDescription.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://tempuri.org/ServiceD
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns="http://tempuri.org/ServiceDescription.xsd" xmlns:mstns="http://tempuri.org/ServiceDescription.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://tempuri.org/ServiceDescription.xsd" elementFormDefault="qualified" id="ServiceDescription">
<xs:element name="Template">
<xs:complexType>
<xs:complexContent>
<xs:extension base="ServiceType">
<xs:all>
<xs:element name="TemplateCode" type="xs:string"/>
</xs:all>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:complexType name="ServiceType">
<xs:all>
<xs:element name="ServiceCode" type="xs:string"/>
</xs:all>
</xs:complexType>
</xs:schema>
当我尝试在XMLSpy中保存它时,它告诉我
An ‘all’ model group is neither allowed in complex type definition ‘mstns:ServiceType’ nor in its extension ‘{anonymous}’.
单击“详细信息”会显示指向a paragraph in XML Schema specification的链接,我不明白.
补充:啊,是的,忘了提 – 错误的行是这一行:
<xs:element name="TemplateCode" type="xs:string"/>问题是,如果你扩展另一种类型,你不能拥有所有.就XML而言,父类型可能具有序列模型,并且由于XML禁止将所有组放入序列组(因为这会破坏序列组的排序),因此XML也禁止将所有组放入复合体的扩展中类型.虽然你可以使用序列而不是全部,但你会没事的.
