Web services 嵌入在xs:sequence中的xs:choice阻止使用联合

Web services 嵌入在xs:sequence中的xs:choice阻止使用联合,web-services,soap,xsd,gsoap,xsd-validation,Web Services,Soap,Xsd,Gsoap,Xsd Validation,我有以下xsd <xsd:complexType name="myID"> <xsd:choice> <xsd:element name="testID" type="priv:testID"/> <xsd:sequence> <xsd:element name="newID" type="priv:newID"/> <xsd:element

我有以下xsd

<xsd:complexType name="myID">
    <xsd:choice>
        <xsd:element name="testID" type="priv:testID"/>
        <xsd:sequence>
            <xsd:element name="newID" type="priv:newID"/>
            <xsd:element name="testID" type="priv:testID" minOccurs="0"/>
        </xsd:sequence>
    </xsd:choice>
</xsd:complexType>

所有内容都在
priv
命名空间下。问题是,
myID
似乎是一个联合体。它可能是
testID
或带有
newID
testID
的序列。当我使用
wsdl2h
gsoap
编译它时,我接受了以下信息:

注:
带嵌入式
防止使用联合体


上面的XSD正确吗

一般来说,XML类型
myID
可以按照您所描述的那样声明。冲突可能与您对类型
priv:testID
priv:testID
的定义有关,您未包括该定义。例如,模式

<?xml version="1.0" encoding="utf-8"?>
<xsd:schema targetNamespace="http://www.ok-soft-gmbh.com/xml/xsd/1.0/XMLSchema.xsd"
    elementFormDefault="qualified"
    xmlns:priv="http://www.ok-soft-gmbh.com/xml/xsd/1.0/XMLSchema.xsd"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>
    <xsd:simpleType name="testID">
        <xsd:restriction base="xsd:string"/>
    </xsd:simpleType>
    <xsd:simpleType name="newID">
        <xsd:restriction base="xsd:string"/>
    </xsd:simpleType>
    <xsd:complexType name="myID">
        <xsd:choice>
            <xsd:element name="testID" type="priv:testID"/>
            <xsd:sequence>
                <xsd:element name="newID" type="priv:newID"/>
                <xsd:element name="testID" type="priv:testID" minOccurs="0"/>
            </xsd:sequence>
        </xsd:choice>
    </xsd:complexType>
    <xsd:element name="root" type="priv:myID"/>
</xsd:schema>


这是正确的。因此,如果存在错误,则它不在您发布的部分中。

您的XSD比我的更完整。问题是“在xsd:choice中嵌套序列合法吗”?