混合类型和简单内容

适用于:SQL ServerAzure SQL 数据库Azure SQL 托管实例

SQL Server 不支持将混合类型限制为简单内容。

示例

在下面的 XML 架构集合中, myComplexTypeA 是可以清空的复杂类型。 即它的两个元素都将 minOccurs 设置为 0。 与在 myComplexTypeB 声明中一样,不支持将此限制为简单内容的尝试。 因此,下面的 XML 架构集合创建语句将失败:

CREATE XML SCHEMA COLLECTION SC AS '
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://ns" xmlns:ns="http://ns"
xmlns:ns1="http://ns1">
    <complexType name="myComplexTypeA" mixed="true">
        <sequence>
            <element name="a" type="string" minOccurs="0"/>
            <element name="b" type="string" minOccurs="0" maxOccurs="23"/>
        </sequence>
    </complexType>
    <complexType name="myComplexTypeB">
        <simpleContent>
            <restriction base="ns:myComplexTypeA">
                <simpleType>
                    <restriction base="int">
                        <minExclusive value="25"/>
                    </restriction>
                </simpleType>
            </restriction>
        </simpleContent>
    </complexType>
</schema>
';
GO

另请参阅