<...">

How do you define an XSD that allows you to use a range of items in any order?

I have an XSD that looks something like this:

<element name="a"> <complexType> <sequence> <element name="b" type="t:typ" minOccurs="1" maxOccurs="unbounded" /> <element name="c" type="t:typ" minOccurs="1" maxOccurs="unbounded" /> </sequence> </complexType> </element> 

How would I change it so that instead of a sequence I could allow the b and c tags to be mixed in any order, for example. How can i do this?..

 <a> <b /> <c /> <b /> <c /> <b /> <b /> </a> 

The "all" option sounded promising, but it seems to allow no more than one of its children.

+4
source share
2 answers

I believe you want this:

 <element name="a"> <complexType> <choice maxOccurs="unbounded"> <element name="b" type="t:typ" /> <element name="c" type="t:typ" /> </choice> </complexType> </element> 
+4
source

Could you try an unlimited sequence of selection items? Something like that? (Unverified)

 <element name="a"> <complexType> <sequence maxOccurs="unbounded" minOccurs="0"> <choice> <element name="b" type="t:typ" /> <element name="c" type="t:typ" /> </choice> </sequence> </complexType> </element> 
0
source

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


All Articles