<xs:element name="Kunde" type="tKunde"/>
<xs:complexType name="tKunde">
<xs:union memberTypes="tPerson tStudent"></xs:union>
</xs:complexType>
<xs:complexType name="tPerson">
<xs:sequence>
<xs:element name="Vorname" type="xs:string"/>
<xs:element name="Nachname" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="tStudent">
<xs:complexContent>
<xs:extension base="tPerson">
<xs:sequence>
<xs:element name="Matrikelnummer" type="xs:int" minOccurs="0" maxOccurs="1"/>
</xs:seque开发者_Go百科nce>
</xs:extension>
</xs:complexContent>
</xs:complexType>
Thats what it should look like. The task is to derive a Student from Person and then make it possible to use one of the two types for the element Kunde.
This seems to be invalid.
You can't use xs:union for this. You can either use xs:choice, or put the elements in a substitution group so any of them can appear in place of the element at the head of the substitution group.
精彩评论