XSD: Is the parent element optional when the child sequence has minOccurs=0?



Given the XSD file



<?xml version="1.0" encoding="UTF-8"?>
<xs:schema version="1.0" xmlns:xs="http://ift.tt/tphNwY">
<xs:element name="myElement" type="myType"/>
<xs:complexType name="myType">
<xs:sequence>
<xs:element name="myContent">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="myContentElement" nillable="true" type="myContentType"/>
</xs:sequence>
</xs:complexType>
</xs:sequence>
</xs:complexType>
</xs:element>


Does the minOccurs in the innermost sequence propagate up in some way?


In other words: would the following be valid xml for this XSD:

<?xml version="1.0" encoding="UTF-8"?><myElement/>?


I would have expected to get at least this:

<?xml version="1.0" encoding="UTF-8"?><myElement><myContent/></myElement>


No comments:

Post a Comment