Muokkaa

Jaa


Mixed type and simple content

Applies to: SQL Server Azure SQL Database Azure SQL Managed Instance

SQL Server doesn't support restricting a mixed type to a simple content.

Example

In the following XML schema collection, myComplexTypeA is a complex type that can be emptied. That is, both its elements have minOccurs set to 0. The attempt to restrict this to a simple content, as in the myComplexTypeB declaration, isn't supported. Therefore, the following XML schema collection creation fails:

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

See also