XSD SchemaLesson 90Free preview
XSD Elements-only
This lesson is part of XML · All levels
Summary
Elements containing only children are declared with <xs:complexType> that contain content models of xs:sequence, xs:choice, or xs:all. The attributes minOccurs and maxOccurs in each child govern whether they are mandatory, optional, or repeatable. Using maxOccurs="unbounded" and a combination of minOccurs, a flexible list structure can be modeled.
Key points
- Obliging the child to appear in the order of declaration
- MinOccurs="0" makes the child optional
- MaxOccurs="unbounded" allows children to repeat indefinitely
- A child of the complex type can use a named type to save declaration.
- Attributes are placed after the content model within the same complexType
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.