<xs:sequence>
不能包含一个<xs:complexType>
作为一个孩子。你必须把它放在别处。要么将其包装在一个元素中,从而有效地使其成为嵌套类型,要么将其<xs:schema>
作为全局类型直接放入元素中。
正如错误消息所说,您可以放入的唯一标签<xs:sequence>
是:
<xs:element>
<xs:group>
<xs:choice>
<xs:sequence>
<xs:any>
此外,<xs:extension>
不能将<xs:element>
标签作为子项。您必须将它们包装在<xs:sequence>
, <xs:choice>
,<xs:all>
等中,具体取决于您想要实现的目标。
最后,<xs:element>
不能包含其他<xs:element>
标签作为子标签。您必须将它们包装在序列/选择/全部等中,然后<xs:complexType>
定义嵌套类型。或者将其全部移到外部以用作全局类型。
这是一个有效的文档,定义了您在上面尝试执行的操作。虽然我没有深入了解整个文档,因此可能需要根据上下文进行调整。
<xs:schema version="1.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:complexType name="blah"> <!-- You said there was a complexType open, I added its opening tag and gave it a placeholder name -->
<xs:sequence>
<xs:element name="qualificationRequired" type="ExtendedQualification"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ExtendedQualification"> <!-- the complexType is now removed from your sequence and is a global type-->
<xs:complexContent>
<xs:extension base="qualifications">
<xs:sequence> <!-- you can't have an element here, you must wrap it in a sequence, choice, all, etc. I chose sequence as it seems to be what you meant -->
<xs:element name="other">
<xs:complexType> <!-- same here, an element can't contain other element tags as children. For a complex element, you need a complexType. I defined it as a nested type -->
<xs:sequence> <!-- even complexType can't have element tags as children, again, I used a sequenct -->
<xs:element name="skills" type="xs:string"/>
<xs:element name="languages" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>