I want to model a situation where you can have multiple children of an element, and the children can be different types and in any order. A simple example of what I mean is at [1]. I am trying to make a schema to define this document, my attempted schema at [2].
If I understand the format correctly I need to make the parent element (building) a complex type, and this must have an order indicator to contain other elements. None of the 3 order indicators (All, Choice, Sequence) fit my model.
How do I do this? It seems I am missing something fundamental, or I am trying to model data that cannot be fit to xml.
Thank you for any help.
[1]
<building name="house1">
<window state="open"/>
<door state="open"/>
<door state="closed"/>
<window state="closed"/>
</building>
[2]
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="building">
<xs:annotation>
<xs:documentation>a building</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence> <!-- This tag is the problem -->
<xs:element name="window" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="state" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="door" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="state" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>