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