MENTAT wrote:
> Newbie question here. Part of my xml looks like this.
>
> <node>
> <description/>
> <config/>
> <log/>
> <transition/>
> <node>
>
> The transition element inside the node is compulsory. The other
> elements are optional and can occur as many times (minOccurs="0"
> maxOccurs="unbounded").
>
> How do I write an xsd that validates this?
How about xs:sequence e.g.
<xs:element name="node">
<xs:complexType>
<xs:sequence>
<xs:element name="description" minOccurs="0"
maxOccurs="unbounded" />
<xs:element name="config" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="log" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="transition" minOccurs="1"
maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
that way you have the constraints modelled as described. Of course the
order of elements is constrained that way too but your description
doesn't make it clear whether you do not want that.
--
Martin Honnen
http://JavaScript.FAQTs.com/