Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
任何已定义类型的组件集合的XML架构_Xml_Xsd_Xsd Validation_Xml Validation - Fatal编程技术网

任何已定义类型的组件集合的XML架构

任何已定义类型的组件集合的XML架构,xml,xsd,xsd-validation,xml-validation,Xml,Xsd,Xsd Validation,Xml Validation,我已经定义了类型inputExtType和inputEmailType的组件(它们的定义在这里并不重要)。我需要以任何顺序(例如:文本、电子邮件、文本、文本)收集任何数量的inputText和/或inputEmail组件。我试过: <xs:complexType name="componentsType"> <xs:choice> <xs:element name="inputText" type="inputTextType" maxOcc

我已经定义了类型
inputExtType
inputEmailType
的组件(它们的定义在这里并不重要)。我需要以任何顺序(例如:文本、电子邮件、文本、文本)收集任何数量的inputText和/或inputEmail组件。我试过:

<xs:complexType name="componentsType">
    <xs:choice>
        <xs:element name="inputText" type="inputTextType" maxOccurs="unbounded" minOccurs="0"/>
        <xs:element name="inputEmail" type="inputEmailType" maxOccurs="unbounded" minOccurs="0"/>
    </xs:choice>
</xs:complexType>

它起作用了,但我无法定义文本、电子邮件、文本、文本,只能先定义所有文本,然后定义所有电子邮件。

将出现约束上移到
xs:choice

<xs:choice minOccurs="0" maxOccurs="unbounded">
    <xs:element name="inputText" type="inputTextType"/>
    <xs:element name="inputEmail" type="inputEmailType"/>
</xs:choice>

<xs:complexType name="componentsType">
    <xs:choice>
        <xs:element name="inputText" type="inputTextType" maxOccurs="unbounded" minOccurs="0"/>
        <xs:element name="inputEmail" type="inputEmailType" maxOccurs="unbounded" minOccurs="0"/>
    </xs:choice>
</xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
    <xs:element name="inputText" type="inputTextType"/>
    <xs:element name="inputEmail" type="inputEmailType"/>
</xs:choice>