需要(递归)xsd组的帮助吗

需要(递归)xsd组的帮助吗,xsd,Xsd,我有这个xsd: <?xml version="1.0" encoding="utf-8" ?> <xs:schema xmlns="http://myschema.com/schema" targetNamespace="http://myschema.com/schema" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:complexType name="aT

我有这个xsd:

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema xmlns="http://myschema.com/schema"
           targetNamespace="http://myschema.com/schema"
           xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:complexType name="aType" mixed="true">
        <xs:group ref="aElements" minOccurs="0" maxOccurs="unbounded"/>
    </xs:complexType>

    <xs:group name="aElements">
        <xs:choice>
            <xs:element name="a" type="aType"/>
        </xs:choice>
    </xs:group>

    <xs:element name="b">
        <xs:complexType>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:group ref="aElements"/>
            </xs:choice>
        </xs:complexType>
    </xs:element>
</xs:schema>

我尝试根据它验证此xml文档:

<?xml version="1.0" encoding="utf-8" ?>
<b xmlns="http://myschema.com/schema">
    <a/>
</b>

“”在命名空间“”中具有无效的子元素“a”。预期的可能元素列表:“a”

有什么问题

编辑:哎呀,当我使示例变得简单时,我忘记了在元素内部使元素成为可选的,这导致了无限递归。不过,这个mod的问题仍然存在



ANSWER:答案是xs:schema标记应该包括elementFormDefault=“qualified”属性。

您使用
aType
定义
aeelements
,使用
aeelements
定义
aType
。我不是xsd专家,但这应该如何工作呢?

使用xsd开发编辑器可以使您的生活更加轻松。我们已经使用液体很多年了,它使生活更轻松