Difference mixed = true and xs: extension in XML Schema

What is the practical difference between the two:

<xs:element name="A"> <xs:complexType mixed="true"> <xs:attribute name="att" type="xs:boolean"/> </xs:complexType> </xs:element> <xs:element name="B"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="att" type="xs:boolean"/> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> 
+6
source share
1 answer

These are two options. The first example uses mixed="true" , which stands for mixed content, i.e. Character data mixed with children. While your second example restricts the content of an element to xs:string . Both indicate the presence of an attribute.

In your example, both of them are almost the same. However, if you do not plan to have mixed content, i.e. You do not plan to add children, the second version is much clearer.

+11
source

Source: https://habr.com/ru/post/888723/


All Articles