| title | Mixed Type and Simple Content | |
|---|---|---|
| description | View an example showing that SQL Server doesn't support creating an XML schema that restricts a mixed type to a simple content. | |
| author | MikeRayMSFT | |
| ms.author | mikeray | |
| ms.reviewer | randolphwest | |
| ms.date | 05/05/2022 | |
| ms.service | sql | |
| ms.subservice | xml | |
| ms.topic | concept-article | |
| ms.custom |
|
|
| helpviewer_keywords |
|
[!INCLUDE SQL Server Azure SQL Database Azure SQL Managed Instance FabricSQLDB]
[!INCLUDEssNoVersion] doesn't support restricting a mixed type to a simple content.
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