0

I have an element A with children B and C. They can occur in any order but:

  • B should unlimited or not at all
  • C can occur only once or not at all

I tried to do it with <xs:all> but it doesn't accept maxOccurs="unbounded".

Example Code:

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="A">
        <xs:complexType>
            <xs:all>
                <xs:element name="B" minOccurs="0"
                            maxOccurs="unbounded" type="xs:string"/>
                <xs:element name="C" minOccurs="0" 
                            maxOccurs="1" type="xs:string"/>
            </xs:all>
        </xs:complexType>
    </xs:element>
</xs:schema>

Is here another way to accomplish this?

kjhughes
  • 106,133
  • 27
  • 181
  • 240
Byomeer
  • 426
  • 6
  • 10
  • 1
    http://stackoverflow.com/questions/2362365/xsd-doesnt-allow-me-to-have-unbounded-inside-all-indicator , http://stackoverflow.com/questions/9097636/xml-schema-maxoccurs-and-xsall , http://stackoverflow.com/questions/14622677/xml-schema-maxoccurs-unbounded-within-xsall – user2864740 May 29 '16 at 22:21
  • Already looked at this question/answers: `` does not fit my needs (as it would destroy the maxOccurs="1" of C) – Byomeer May 29 '16 at 22:26

0 Answers0