混合型と単純コンテンツ

適用対象:SQL ServerAzure SQL DatabaseAzure SQL Managed Instance

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

関連項目